SlideShare a Scribd company logo
ASP .NET
syllabus
• The .NET framework is a software development platform developed
by Microsoft. The framework was meant to create applications, which
would run on the Windows Platform. The first version of the .Net
framework was released in the year 2002.
• The version was called .NET framework 1.0. The .NET framework has
come a long way since then, and the current version is 4.7.1.
• The .NET framework can be used to create both - Form-
based and Web-based applications. Web services can also be
developed using the .NET framework.
Aspdot
The "Common Language Infrastructure" or CLI is a platform on which the .Net
programs are executed.
• Exception Handling - Exceptions are errors which occur when the
application is executed.Examples of exceptions are:
A,If an application tries to open a file on the local machine, but the file
is not present.
B,If the application tries to fetch some records from a database, but the
connection to the database is not valid.
• Garbage Collection - Garbage collection is the process of removing
unwanted resources when they are no longer required.
A,A File handle which is no longer required. If the application has
finished all operations on a file, then the file handle may no longer be
required.
Class Library
• The .NET Framework includes a set of standard class libraries. A class
library is a collection of methods and functions that can be used for
the core purpose.
• For example, there is a class library with methods to handle all file-
level operations. So there is a method which can be used to read the
text from a file. Similarly, there is a method to write text to a file.
• Most of the methods are split into either the System.* or Microsoft.*
namespaces. (The asterisk * just means a reference to all of the
methods that fall under the System or Microsoft namespace)
Languages
• The types of applications that can be built in the .Net framework is classified
broadly into the following categories.
• WinForms – This is used for developing Forms-based applications, which would
run on an end user machine. Notepad is an example of a client-based application.
• ASP.Net – This is used for developing web-based applications, which are made to
run on any browser such as Internet Explorer, Chrome or Firefox.
• The Web application would be processed on a server, which would have Internet Information
Services Installed.
• Internet Information Services or IIS is a Microsoft component which is used to execute
an Asp.Net application.
• The result of the execution is then sent to the client machines, and the output is shown in
the browser.
• ADO.Net – This technology is used to develop applications to interact with
Databases such as Oracle or Microsoft SQL Server.
1.Datatypes:The value types directly contain data.
• Value Types
• A data type is a value type if it holds a data value within its own
memory space. It means variables of these data types directly contain
their values . eg: bool,char,double,decimal,double,enum
• For example consider integer variable int a=100
• The system stores 100 in the memory space allocated for the variable
'i'. The following image illustrates how 100 is stored at some
hypothetical location in the memory (0x239110) for ‘i’
Reference Type
• Unlike value types, a reference type doesn't store its value directly.
Instead, it stores the address where the value is being stored. In other
words, a reference type contains a pointer to another memory
location that holds the data.
• Eg: string, array, Delegate
2.Nullable types
• C# 2.0 introduced nullable types that allow you to assign null to value
type variables
• Ege:Nullable <int>i=null;
• A C# nullable type is a data type is that contain the defined
data type or the value of null.
• It is used for converting an operand to the type of
another nullable (or not) value type operand, where an implicit
conversion is possible.
3.Datatype conversion
A,Implicit Type Conversion
• Type conversion happens when we assign the value of one data type
to another. If the data types are compatible, then C# does Automatic
Type Conversion/Implicit Type conversion.
• Byte->short->int->long->float->double
Convert From Data Type Convert to datatype
byte short, int, long, float, double
short int, long, float, double
int long, float, double
long float, double
float double
B,Explicit Conversion
• if we want to assign a value of larger data type to a smaller data type
we perform explicit type casting.
• target-type specifies the desired type to convert the specified value
to. Sometimes, it may result into the lossy conversion
• Public static void main(string ()args)
• {
double d=768.12;
int i=(int d); console.writeline(“ The value of i”,+i);
• }
Here due to lossy conversion, the value of i becomes 765 and there is
a loss of 0.12 value.
C,Built in Type conversion
• C# provides built-in methods for Type-Conversions
ToBoolean It will converts a type to Boolean value
ToChar It will converts a type to a character value
ToByte It will converts a value to Byte Value
ToDecimal It will converts a value to Decimal point value
ToDouble It will converts a type to double data type
ToInt32 It will converts a type to 32 bit integer
ToInt64 It will converts a type to 64 bit integer
ToString It will converts a given type to string
4.Operators
a,Arithmetic Operators
operator Description Example
+ Add Two operands A+B
- Subtract second operand From
First
A-B
* Multiplies both Operand A*B
/ Divide numerator By Denominator A/B
% Modulus Operator and remainder
after division
A%B=0
++/-- Increment operator /Decrement
Operator
A++=11/A--=9
Arithmetic operator
B,Relational Operator
operator Description Example
== Checks if the values of two
operands are equal or not, if yes
then condition becomes true.
(A==B) is not true
!= Checks if the values of two
operands are equal or not, if values
are not equal then condition
becomes true.
(A!=B) is true
> It returns true if left condition is
greater than right condition.
If A>B
< It returns true if left condition is
less than right condition
If A<B
>= It returns true if left condition is
greater than or equal to right
condition
If A>=B
<= It returns true if left condition is
lower than or equal to right
condition
If A<=B
Example for Relational Operator
C,Logical Operators
operator Description Comments
&&(AND) Called Logical AND operator. If both
the operands are non zero then
condition becomes true.
(A && B) is false
||(OR) Called Logical OR Operator. If any of
the two operands is non zero then
condition becomes true.
(A || B) is true
! Called Logical NOT Operator. Use to
reverses the logical state of its
operand. If a condition is true then
Logical NOT operator will make
false.
!(A && B) is true
Logical operator
Bitwise Operator
Operator and their functions
Example
Assignment operator
5.Arrays
• Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.
• To declare an array, define the variable with square bracket
• string [] cars={‘Volvo’,’BMW’,’Audi’}
• Console. WriteLine(cars[0]);
• Console. WriteLine(cars. Length);
• For (int i=0;i<car.length;i++) {
Console.writeline(car[i]);
}
foreach(int I in cars)
{
console.writeline(i)
}
a.Single Dimensional Array
• The one dimensional array or single dimensional array in C# is the
simplest type of array that contains only one row for storing data. It
has single set of square bracket (“[]”).
• Eg: string [] books=new string[5];
b.Multidimensional Array
• A multi-dimensional array in C# is an array that contains more than
one rows to store the data.
• Eg: Here declares a two-dimensional array of four rows and two
columns of int type. This array can store int values only
• Int[,] int2d=new int[4,2] -> 2 dimensional array
• String[ , ,]string3d=new string[4,2,3]-> 3 dimensional array
Example for multi dimensional array
Examples of Multidimensional array
Using system;
Namespace Myapplication{
Class Array{
Static void main(string[]args)
{
Int [,]a=new int[5,2]{{0,0},{1,2},{2,4},{3,6},{4,8}}
Int i,j;
For( i=0;i<5;i++)
{
For(j=0;j<2;j++)
{
Console. WriteLine(“ a[{0},{1}={2}]”,I,j,[I,j])
}
}
Console.readkey();
}
C.Jagged Array
• A jagged array is an array whose elements are arrays. The elements of a jagged
array can be of different dimensions and sizes. A jagged array is sometimes called
an "array of arrays." .
• A Jagged Array is an array of an array in which the length of each array index can
differ.
• Declaration
• int[][] jaggedArray = new int[3][];
• jaggedArray[0] = new int[3];
• jaggedArray[1] = new int[5];
• jaggedArray[2] = new int[2];
• jaggedArray[0] = new int[] { 3, 5, 7, };
• jaggedArray[1] = new int[] { 1, 0, 2, 4, 6 };
• jaggedArray[2] = new int[] { 1, 6 };
Example
Using system;
Namespace jaggedarray
Class program{
Static void main (string args[])
{
Int [][]jaggedarray=new int [2][];
Jaggedarray[0]=new int[2]{7,9};
Jaggedarray[1]=new int[6]{1,2,3,4,5,6};
For (int i=0;i<jaggedarray.length;i++)
System.console.write(“element{0}”,i+1)
For (int j=0;j<jaggedarray.length;j++)
{
System.console.write(jaggedarray[i][j]+”t”);
}
System.console.writeline();
}
Console.readline();
}
6.Conditional Statement
A,IF statement:
• An if statement consists of a Boolean expression followed by one or
more statements.
Syntax: if(Boolean_expression)
{
//statement execute if Boolean expression is true
}
If the boolean expression evaluates to true, then the block of code
inside the if statement is executed. If boolean expression evaluates
to false, then the first set of code after the end of the if statement(after
the closing curly brace) is executed
Example Program for If condition
Else if
Switch statement
• Switch statement can be used to replace the if...else if statement in
C#. The advantage of using switch over if...else if statement is the
codes will look much cleaner and readable with switch.
• Switch(variable/expression)
• {
• Case value1:
• //statement executed if expression(or variable)=value1
• }
Example for switch
For Loop
• The for keyword indicates a loop in C#. The for loop executes a block
of statements repeatedly until the specified condition returns false.
Syntax:for (variable initialization; condition; steps)
• { //execute this code block as long as condition is satisfied }
• variable initialization: Declare & initialize a variable here which will be
used in conditional expression and steps part.
• condition: The condition is a boolean expression which will return
either true or false.
• steps: The steps defines the incremental or decremental part
Sum of first n natural number
• Public static void main(string [] args)
{ int n,sum=0;
n=convert.int32(console.readline());
Console.writeline(“Enter the limit”);
for(int i=0i<n;i++)
{
Sum =sum+I;
}
Console.writeline(“sum of{0} numbers={1}”,n,sum);
}
Infinite Loop
• Public static void main(string []args)
• {
• For (i=1;i>0;i++)
• {
• Console.writeline(“loop is executing {0}”,i);
• }
• }
While loop
• While(Boolean Expression)
{
// execute code and Returns True
}
As per the while loop syntax, the while loop includes a boolean
expression as a condition which will return true or false. It executes the
code block, as long as the specified conditional expression returns true.
Here, the initialization should be done before the loop starts and
increment or decrement steps should be inside the loop.
Class program
{
Static void main(string [] args)
{
Int a=10;
While (a<20)
{console.writeline(“The value of a {0}”,a)}
a++;
}
Console.readline()
}
Example for while Loop
Do-while Loop
• The C# do-while loop is used to iterate a part of the program several
times. If the number of iteration is not fixed and you must have to
execute the loop at least once, it is recommended to use do-while
loop.
• The C# do-while loop is executed at least once because condition is
checked after loop body.
Aspdot
Foreach Loop
• The foreach loop is used to iterate over the elements of the
collection. The collection may be an array or a list. It executes for each
element present in the array.
• Syntax: foreach(element in iterable item)
{
//Body of foreach Loop
}
Difference between foreach & For loop
Foreach
8.Methods in C#
• Method is a body where we put the logic to get some work done.
• Here is the list of Method type in C#.
• Pure virtual method.
• Virtual method.
• Abstract method.
• Partial method.
• Extension method.
• Instance method.
• Static method.
A,Pure virtual Method
• Pure virtual method is the term that programmers use in C++. There
is a term "abstract" in place of "pure virtual method" in C#.
• public void abstract DoSomething();
B,Virtual MethodVirtual method makes some default functionality. In other words, virtual methods are being implemented in the base class
and can be overridden in the derived class.
• public class A
• {
• public virtual int Calculate(int a, int b)
• {
• return a + b;
• }
• }
• public class B: A
• {
• public override int Calculate(int a, int b)
• {
• return a + b + 1;
• }
• }
C,Abstract Method
Abstract Method is the method with no implementation and is
implicitly virtual. You can make abstract method only in Abstract class.
public void abstract DoSomething(int a);
D,Partial Method
A partial method has its signature defined in one part of a partial type, and its implementation defined in another part of the type.
• partial class A
• {
• partial void OnSomethingHappened(string s);
• }
• // This part can be in a separate file.
• partial class A
• {
• // Comment out this method and the program
• // will still compile.
• partial void OnSomethingHappened(String s)
• {
• Console.WriteLine("Something happened: {0}", s);
• }
• }
E,Extension Method
• Extension methods are a special kind of static method, but they are
called as if they were instance methods on the extended type.
Extension methods are used to add some functionality to given type.
• public static class ExtensionMethods
• { public static string UppercaseFirstLetter(this string value)
• {
• if (value.Length > 0)
• {
• char[] array = value.ToCharArray();
• array[0] = char.ToUpper(array[0]);
• return new string(array);
• }
• return value;
• } }
• class Program
• {
• static void Main()
• {
• //
• // Use the string extension method on this value.
• //
• string value = "deeksha sharma";
• value = value.UppercaseFirstLetter();
• Console.WriteLine(value);
• }
• }
F,Instance Method :An instance method operates on a given instance of
a class, and that instance can be acessed as this.
g.Static Method
• This belongs to the type, it does not belong to instance of the type.
You can access static methods by class name.
•
• You can put static method in static or non- static classes.
The only difference is that static methods in a non-static class cannot
be extension methods.
Static often improves performance.
Aspdot
Enums
• In C#, enum is a value type data type. The enum is used to declare a
list of named integer constants.
• It can be defined using the enum keyword directly inside a
namespace, class, or structure.
• The enum is used to give a name to each constant so that the
constant integer can be referred using its name.
• An enum is used to create numeric constants in the .NET framework.
All the members of enum are enum type. There must be a numeric
value for each enum type.
Example for Enum
Enum example
Enum months
{January,February,March,April}
Static void main(string [] args)
{
Int num=(int)months.April;
Console.writeline(num);
}
Namespace
• Namespaces in C# are used to organize too many classes so that it can be
easy to handle the application.
• In a simple C# program, we use System.Console where System is the
namespace and Console is the class. To access the class of a namespace,
we need to use namespacename.classname. We can use using keyword so
that we don't have to use complete name all the time.
• NameSpace is the Logical group of types or we can say namespace is a
container (e.g Class, Structures, Interfaces, Enumerations, Delegates
etc.), example System.IO logically groups input output related features ,
System. Data. SqlClient is the logical group of ado.net Connectivity with Sql
server related features.
Example for accessing Namespace
Class
• Classes are the user defined data types that represent
the state and behaviour of an object. State represents the properties
and behaviour is the action that objects can perform.
•
• All classes have a base type of System.Object.
• The default access modifier of a class is Internal.
• The default access modifier of methods and variables is Private
Abstract Class
• An Abstract class is a class that provides a common definition to the subclasses
and this is the type of class whose object is not created.
• Abstract classes are declared using the abstract keyword.
• We cannot create an object of an abstract class.
• If you want to use it then it must be inherited in a subclass.
• An Abstract class contains both abstract and non-abstract methods.
• The methods inside the abstract class can either have an implementation or no
implementation.
• We can inherit two abstract classes; in this case the base class method
implementation is optional.
• An Abstract class has only one subclass.
• Methods inside the abstract class cannot be private.
• Public abstract void geek()
• {
• // method geek is an abstract
• }
• Abstract Method: A method which is declared abstract, has no
“body” and declared inside the abstract class only.
• abstract class gfg
• Abstract Class: This is the way to achieve the abstraction in C#. An
Abstract class is never intended to be instantiated directly. This class
must contain at least one abstract method, which is marked by the
keyword or modifier abstract in the class definition. The Abstract
classes are typically used to define a base class in the class hierarchy.
Using system
Public abstract class program{
Public abstract void sample();
}
Public geek1:program{
Public overide sample(){
Console.writeline(“Geek 1program”);}
Public geek2:program{
Public override sample(){
Console.writeline(“Geek 2 program”);}
Public class main_method{
Public static void main(){
Program g;
g=new geek1();
g.sample();
g=new geek2();
g.sample();
}}
Partial Classes
• A partial class is a special feature of C#. It provides a special ability to
implement the functionality of a single class into multiple files and all these
files are combined into a single class file when the application is compiled.
• A partial class is created by using a partial keyword. This keyword is also
useful to split the functionality of methods, interfaces, or structure into
multiple files.
• Syntax :public partial classname
• {
• code
• }
Examples
• Public partial class Geeks{
private string author_name,private int Total_articles;}
Public geeks(string a,int t){
This.author_name=a;
This.Total_articles=t;}
Public partial class Geeks{
Public void display{
Console.writeline(“Author Name is”+author_name);
Console.writeline(“Total articls is ”+Total_articles);
} }
• public class Geeks {
• private string Author_name;
• private int Total_articles;
• public Geeks(string a, int t)
• {
• this.Authour_name = a;
• this.Total_articles = t;
• }
• public void Display()
• {
• Console.WriteLine("Author's name is : " + Author_name);
• Console.WriteLine("Total number articles is : " + Total_articles);
• }
• }
Sealed class
• Sealed classes are used to restrict the inheritance feature of object
oriented programming. Once a class is defined as a sealed class, this class
cannot be inherited.
•
In C#, the sealed modifier is used to declare a class as sealed. In Visual
Basic .NET, NotInheritable keyword serves the purpose of sealed. If a class
is derived from a sealed class, compiler throws an error.
If you have ever noticed, structs are sealed. You cannot derive a class from
a struct.
Syntax:sealed class SealedClass
{
}
using System;
class Class1 {
static void Main(string[] args) {
SealedClass sealedCls = new SealedClass();
• int total = sealedCls.Add(4, 5);
• Console.WriteLine("Total = " + total.ToString());
• }
• }
• // Sealed class
• sealed class SealedClass
• {
• public int Add(int x, int y)
• {
• return x + y;
• }
• }
• class X {
• protected virtual void F() {
Console.WriteLine("X.F"); }
• protected virtual void F2() {
• Console.WriteLine("X.F2"); } }
• class Y : X { sealed protected override void F() {
• Console.WriteLine("Y.F"); }
• protected override void F2() {
• Console.WriteLine("X.F3"); } }
• class Z : Y { // Attempting to override F causes compiler error CS0239.
• // protected override void F()
• { Console.WriteLine("C.F");
• }
• // Overriding F2 is allowed.
• protected override void F2()
• {
• Console.WriteLine("Z.F2");
• }
• }
Static Class
• A C# static class is a class that can't be instantiated. The sole purpose of the
class is to provide blueprints of its inherited classes. A static class is created
using the "static" keyword in C#. A static class can contain static members
only. You can‘t create an object for the static class.
• Advantages of Static Classes
• If you declare any member as a non-static member, you will get an error.
• When you try to create an instance to the static class, it again generates a
compile time error, because the static members can be accessed directly
with its class name.
• The static keyword is used before the class keyword in a class definition to
declare a static class.
• A static class members are accessed by the class name followed by the
member name.
Example for static Method
Static Members
• A static class is basically the same as non static class.But one
difference is it cannot instantiated.In other words you cannot use the
new operator to create the variable of class type.Because there is no
instance variable you can acess the member of static class By using
the class Itself.if you have a static class named utilityclass that has a
public static method MethodA.
• You can call the method
• Utilityclass.MethodA()
Instance Members
• An instance data member of a class is recreated each time when a
new instance of the class is created and it is associated with that
instance only.
Aspdot
13.Inheritance
• In C#, inheritance is a process in which one object acquires all the
properties and behaviors of its parent object automatically. In such
way, you can reuse, extend or modify the attributes and behaviors
which is defined in other class.
• In C#, the class which inherits the members of another class is
called derived class and the class whose members are inherited is
called base class. The derived class is the specialized class for the base
class.
• Code reusability: Now you can reuse the members of your parent
class. So, there is no need to define the member again. So less code is
required in the class.
1.Single Level Inheritance: When one class inherits another class, it is known as single level
inheritance
• .
Multi Level:When one class inherits another class which is further inherited by another class, it is
known as multi level inheritance in C
Hierarchical inheritance: In this type of inheritance, there is one parent class and the other derived classes inherit the
same parent class to achieve this inheritance.
Multiple Inheritance using interface
•
Hybrid Inheritance
• Hybrid Inheritance(Through Interfaces): It is a mix of two or more of
the above types of inheritance. Since C# doesn’t support multiple
inheritance with classes, the hybrid inheritance is also not possible
with classes. In C#, we can achieve hybrid inheritance only through
Interfaces.
Aspdot
Polymorphisam
• Polymorphism is a Greek word, meaning "one name many forms". In other
words, one object has many forms or has one name with multiple
functionalities.
• "Poly" means many and "morph" means forms. Polymorphism provides the
ability to a class to have multiple implementations with the same name
• There are two types of polymorphism in C#:
1.Static / Compile Time Polymorphism.
2.Dynamic / Runtime Polymorphism.
Aspdot
Static or Compile Time polymorphisam
• It is also known as Early Binding. Method overloading is an example of
Static Polymorphism. In overloading, the method / function has a
same name but different signatures. It is also known as Compile Time
Polymorphism because the decision of which method is to be called is
made at compile time. Overloading is the concept in which method
names are the same with a different set of parameters.
Here C# compiler checks the number of parameters passed and the
type of parameter and make the decision of which method to call and
it throw an error if no matching method is found.
Compile time polymorphisam
Dynamic or Runtime Polymorphisam
• Dynamic / runtime polymorphism is also known as late binding. Here, the
method name and the method signature (number of parameters and
parameter type must be the same and may have a different
implementation). Method overriding is an example of dynamic
polymorphism.
Method overriding can be done using inheritance. With method overriding
it is possible for the base class and derived class to have the same method
name and same something. The compiler would not be aware of the
method available for overriding the functionality, so the compiler does not
throw an error at compile time. The compiler will decide which method to
call at runtime and if no method is found then it throws an error.
Aspdot
Method Overriding & Method Hiding
• Method Overriding is a technique that allows the invoking of
functions from another class (base class) in the derived class. Creating
a method in the derived class with the same signature as a method in
the base class is called Method Overriding.
In simple words, Overriding is a feature that allows a subclass or child
class to provide a specific implementation of a method that is already
provided by one of its super-classes or parent classes. When a
method in a subclass has the same name, same parameters or
signature and the same return type(or sub-type) as a method in its
super-class, then the method in the subclass is said to override the
method in the super-class.
Aspdot
Method Hiding
• In Method Hiding, you can hide the implementation of the methods
of a base class from the derived class using the new keyword. Or in
other words, in method hiding, you can redefine the method of the
base class in the derived class by using the new keyword.
Aspdot
Aspdot
Method Overloading
• Method Overloading is the common way of implementing polymorphism.
It is the ability to redefine a function in more than one form. A user can
implement function overloading by defining two or more functions in a
class sharing the same name. C# can distinguish the methods
with different method signatures. i.e. the methods can have the same
name but with different parameters list
• Different ways of doing overloading methods-
Method overloading can be done by changing:
• The number of parameters in two methods.
• The data types of the parameters of methods.
• The Order of the parameters of methods.

More Related Content

PDF
Constructors and destructors
PDF
PDF
A COMPLETE FILE FOR C++
PPT
Object-Oriented Programming Using C++
PDF
Object Oriented Programming using C++ Part I
PDF
C++ Templates 2
PDF
Constructors destructors
PPT
Input and output in C++
Constructors and destructors
A COMPLETE FILE FOR C++
Object-Oriented Programming Using C++
Object Oriented Programming using C++ Part I
C++ Templates 2
Constructors destructors
Input and output in C++

What's hot (15)

PPT
02 functions, variables, basic input and output of c++
PPT
C++ Returning Objects
PPTX
Arrays
PPTX
Intro To C++ - Class #18: Vectors & Arrays
PPTX
Presentation 2nd
PDF
Generic Programming
PPTX
Constructors & Destructors
PPTX
45 Days C++ Programming Language Training in Ambala
PPT
C++ - Constructors,Destructors, Operator overloading and Type conversion
PDF
Intake 38 5
PPTX
Presentation 4th
PPT
Generic Programming seminar
PDF
ScalaTrainings
PPTX
Objective c slide I
02 functions, variables, basic input and output of c++
C++ Returning Objects
Arrays
Intro To C++ - Class #18: Vectors & Arrays
Presentation 2nd
Generic Programming
Constructors & Destructors
45 Days C++ Programming Language Training in Ambala
C++ - Constructors,Destructors, Operator overloading and Type conversion
Intake 38 5
Presentation 4th
Generic Programming seminar
ScalaTrainings
Objective c slide I
Ad

Similar to Aspdot (20)

PPSX
DISE - Windows Based Application Development in C#
PPSX
DITEC - Programming with C#.NET
PPT
fdjkhdjkfhdjkjdkfhkjshfjkhdkjfhdjkhf2124C_2.ppt
PDF
C# Dot net unit-2.pdf
PDF
Introduction to C3.net Architecture unit
PPTX
PPTX
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
PDF
C# quick ref (bruce 2016)
PDF
2.Getting Started with C#.Net-(C#)
PPTX
2.overview of c#
PPT
Introduction to C#
PPTX
C sharp part 001
PPTX
CS4443 - Modern Programming Language - I Lecture (2)
PPT
Presentatiooooooooooon00000000000001.ppt
PDF
C Sharp: Basic to Intermediate Part 01
PPTX
unit 1 (1).pptx
PPTX
2 programming with c# i
PPTX
C# 101: Intro to Programming with C#
PPTX
c#(loops,arrays)
PPTX
Notes(1).pptx
DISE - Windows Based Application Development in C#
DITEC - Programming with C#.NET
fdjkhdjkfhdjkjdkfhkjshfjkhdkjfhdjkhf2124C_2.ppt
C# Dot net unit-2.pdf
Introduction to C3.net Architecture unit
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
C# quick ref (bruce 2016)
2.Getting Started with C#.Net-(C#)
2.overview of c#
Introduction to C#
C sharp part 001
CS4443 - Modern Programming Language - I Lecture (2)
Presentatiooooooooooon00000000000001.ppt
C Sharp: Basic to Intermediate Part 01
unit 1 (1).pptx
2 programming with c# i
C# 101: Intro to Programming with C#
c#(loops,arrays)
Notes(1).pptx
Ad

Recently uploaded (20)

PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Computing-Curriculum for Schools in Ghana
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
01-Introduction-to-Information-Management.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Updated Idioms and Phrasal Verbs in English subject
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Computing-Curriculum for Schools in Ghana
Anesthesia in Laparoscopic Surgery in India
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial diseases, their pathogenesis and prophylaxis
01-Introduction-to-Information-Management.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
Final Presentation General Medicine 03-08-2024.pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Microbial disease of the cardiovascular and lymphatic systems
LDMMIA Reiki Yoga Finals Review Spring Summer
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Supply Chain Operations Speaking Notes -ICLT Program
Updated Idioms and Phrasal Verbs in English subject

Aspdot

  • 2. • The .NET framework is a software development platform developed by Microsoft. The framework was meant to create applications, which would run on the Windows Platform. The first version of the .Net framework was released in the year 2002. • The version was called .NET framework 1.0. The .NET framework has come a long way since then, and the current version is 4.7.1. • The .NET framework can be used to create both - Form- based and Web-based applications. Web services can also be developed using the .NET framework.
  • 4. The "Common Language Infrastructure" or CLI is a platform on which the .Net programs are executed. • Exception Handling - Exceptions are errors which occur when the application is executed.Examples of exceptions are: A,If an application tries to open a file on the local machine, but the file is not present. B,If the application tries to fetch some records from a database, but the connection to the database is not valid. • Garbage Collection - Garbage collection is the process of removing unwanted resources when they are no longer required. A,A File handle which is no longer required. If the application has finished all operations on a file, then the file handle may no longer be required.
  • 5. Class Library • The .NET Framework includes a set of standard class libraries. A class library is a collection of methods and functions that can be used for the core purpose. • For example, there is a class library with methods to handle all file- level operations. So there is a method which can be used to read the text from a file. Similarly, there is a method to write text to a file. • Most of the methods are split into either the System.* or Microsoft.* namespaces. (The asterisk * just means a reference to all of the methods that fall under the System or Microsoft namespace)
  • 6. Languages • The types of applications that can be built in the .Net framework is classified broadly into the following categories. • WinForms – This is used for developing Forms-based applications, which would run on an end user machine. Notepad is an example of a client-based application. • ASP.Net – This is used for developing web-based applications, which are made to run on any browser such as Internet Explorer, Chrome or Firefox. • The Web application would be processed on a server, which would have Internet Information Services Installed. • Internet Information Services or IIS is a Microsoft component which is used to execute an Asp.Net application. • The result of the execution is then sent to the client machines, and the output is shown in the browser. • ADO.Net – This technology is used to develop applications to interact with Databases such as Oracle or Microsoft SQL Server.
  • 7. 1.Datatypes:The value types directly contain data. • Value Types • A data type is a value type if it holds a data value within its own memory space. It means variables of these data types directly contain their values . eg: bool,char,double,decimal,double,enum • For example consider integer variable int a=100 • The system stores 100 in the memory space allocated for the variable 'i'. The following image illustrates how 100 is stored at some hypothetical location in the memory (0x239110) for ‘i’
  • 8. Reference Type • Unlike value types, a reference type doesn't store its value directly. Instead, it stores the address where the value is being stored. In other words, a reference type contains a pointer to another memory location that holds the data. • Eg: string, array, Delegate
  • 9. 2.Nullable types • C# 2.0 introduced nullable types that allow you to assign null to value type variables • Ege:Nullable <int>i=null; • A C# nullable type is a data type is that contain the defined data type or the value of null. • It is used for converting an operand to the type of another nullable (or not) value type operand, where an implicit conversion is possible.
  • 10. 3.Datatype conversion A,Implicit Type Conversion • Type conversion happens when we assign the value of one data type to another. If the data types are compatible, then C# does Automatic Type Conversion/Implicit Type conversion. • Byte->short->int->long->float->double Convert From Data Type Convert to datatype byte short, int, long, float, double short int, long, float, double int long, float, double long float, double float double
  • 11. B,Explicit Conversion • if we want to assign a value of larger data type to a smaller data type we perform explicit type casting. • target-type specifies the desired type to convert the specified value to. Sometimes, it may result into the lossy conversion • Public static void main(string ()args) • { double d=768.12; int i=(int d); console.writeline(“ The value of i”,+i); • } Here due to lossy conversion, the value of i becomes 765 and there is a loss of 0.12 value.
  • 12. C,Built in Type conversion • C# provides built-in methods for Type-Conversions ToBoolean It will converts a type to Boolean value ToChar It will converts a type to a character value ToByte It will converts a value to Byte Value ToDecimal It will converts a value to Decimal point value ToDouble It will converts a type to double data type ToInt32 It will converts a type to 32 bit integer ToInt64 It will converts a type to 64 bit integer ToString It will converts a given type to string
  • 13. 4.Operators a,Arithmetic Operators operator Description Example + Add Two operands A+B - Subtract second operand From First A-B * Multiplies both Operand A*B / Divide numerator By Denominator A/B % Modulus Operator and remainder after division A%B=0 ++/-- Increment operator /Decrement Operator A++=11/A--=9
  • 15. B,Relational Operator operator Description Example == Checks if the values of two operands are equal or not, if yes then condition becomes true. (A==B) is not true != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (A!=B) is true > It returns true if left condition is greater than right condition. If A>B < It returns true if left condition is less than right condition If A<B >= It returns true if left condition is greater than or equal to right condition If A>=B <= It returns true if left condition is lower than or equal to right condition If A<=B
  • 17. C,Logical Operators operator Description Comments &&(AND) Called Logical AND operator. If both the operands are non zero then condition becomes true. (A && B) is false ||(OR) Called Logical OR Operator. If any of the two operands is non zero then condition becomes true. (A || B) is true ! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. !(A && B) is true
  • 20. Operator and their functions
  • 23. 5.Arrays • Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value. • To declare an array, define the variable with square bracket • string [] cars={‘Volvo’,’BMW’,’Audi’} • Console. WriteLine(cars[0]); • Console. WriteLine(cars. Length); • For (int i=0;i<car.length;i++) { Console.writeline(car[i]); } foreach(int I in cars) { console.writeline(i) }
  • 24. a.Single Dimensional Array • The one dimensional array or single dimensional array in C# is the simplest type of array that contains only one row for storing data. It has single set of square bracket (“[]”). • Eg: string [] books=new string[5];
  • 25. b.Multidimensional Array • A multi-dimensional array in C# is an array that contains more than one rows to store the data. • Eg: Here declares a two-dimensional array of four rows and two columns of int type. This array can store int values only • Int[,] int2d=new int[4,2] -> 2 dimensional array • String[ , ,]string3d=new string[4,2,3]-> 3 dimensional array
  • 26. Example for multi dimensional array
  • 27. Examples of Multidimensional array Using system; Namespace Myapplication{ Class Array{ Static void main(string[]args) { Int [,]a=new int[5,2]{{0,0},{1,2},{2,4},{3,6},{4,8}} Int i,j; For( i=0;i<5;i++) { For(j=0;j<2;j++) { Console. WriteLine(“ a[{0},{1}={2}]”,I,j,[I,j]) } } Console.readkey(); }
  • 28. C.Jagged Array • A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array of arrays." . • A Jagged Array is an array of an array in which the length of each array index can differ. • Declaration • int[][] jaggedArray = new int[3][]; • jaggedArray[0] = new int[3]; • jaggedArray[1] = new int[5]; • jaggedArray[2] = new int[2]; • jaggedArray[0] = new int[] { 3, 5, 7, }; • jaggedArray[1] = new int[] { 1, 0, 2, 4, 6 }; • jaggedArray[2] = new int[] { 1, 6 };
  • 29. Example Using system; Namespace jaggedarray Class program{ Static void main (string args[]) { Int [][]jaggedarray=new int [2][]; Jaggedarray[0]=new int[2]{7,9}; Jaggedarray[1]=new int[6]{1,2,3,4,5,6}; For (int i=0;i<jaggedarray.length;i++) System.console.write(“element{0}”,i+1) For (int j=0;j<jaggedarray.length;j++) { System.console.write(jaggedarray[i][j]+”t”); } System.console.writeline(); } Console.readline(); }
  • 30. 6.Conditional Statement A,IF statement: • An if statement consists of a Boolean expression followed by one or more statements. Syntax: if(Boolean_expression) { //statement execute if Boolean expression is true } If the boolean expression evaluates to true, then the block of code inside the if statement is executed. If boolean expression evaluates to false, then the first set of code after the end of the if statement(after the closing curly brace) is executed
  • 31. Example Program for If condition
  • 33. Switch statement • Switch statement can be used to replace the if...else if statement in C#. The advantage of using switch over if...else if statement is the codes will look much cleaner and readable with switch. • Switch(variable/expression) • { • Case value1: • //statement executed if expression(or variable)=value1 • }
  • 35. For Loop • The for keyword indicates a loop in C#. The for loop executes a block of statements repeatedly until the specified condition returns false. Syntax:for (variable initialization; condition; steps) • { //execute this code block as long as condition is satisfied } • variable initialization: Declare & initialize a variable here which will be used in conditional expression and steps part. • condition: The condition is a boolean expression which will return either true or false. • steps: The steps defines the incremental or decremental part
  • 36. Sum of first n natural number • Public static void main(string [] args) { int n,sum=0; n=convert.int32(console.readline()); Console.writeline(“Enter the limit”); for(int i=0i<n;i++) { Sum =sum+I; } Console.writeline(“sum of{0} numbers={1}”,n,sum); }
  • 37. Infinite Loop • Public static void main(string []args) • { • For (i=1;i>0;i++) • { • Console.writeline(“loop is executing {0}”,i); • } • }
  • 38. While loop • While(Boolean Expression) { // execute code and Returns True } As per the while loop syntax, the while loop includes a boolean expression as a condition which will return true or false. It executes the code block, as long as the specified conditional expression returns true. Here, the initialization should be done before the loop starts and increment or decrement steps should be inside the loop.
  • 39. Class program { Static void main(string [] args) { Int a=10; While (a<20) {console.writeline(“The value of a {0}”,a)} a++; } Console.readline() }
  • 41. Do-while Loop • The C# do-while loop is used to iterate a part of the program several times. If the number of iteration is not fixed and you must have to execute the loop at least once, it is recommended to use do-while loop. • The C# do-while loop is executed at least once because condition is checked after loop body.
  • 43. Foreach Loop • The foreach loop is used to iterate over the elements of the collection. The collection may be an array or a list. It executes for each element present in the array. • Syntax: foreach(element in iterable item) { //Body of foreach Loop }
  • 46. 8.Methods in C# • Method is a body where we put the logic to get some work done. • Here is the list of Method type in C#. • Pure virtual method. • Virtual method. • Abstract method. • Partial method. • Extension method. • Instance method. • Static method.
  • 47. A,Pure virtual Method • Pure virtual method is the term that programmers use in C++. There is a term "abstract" in place of "pure virtual method" in C#. • public void abstract DoSomething();
  • 48. B,Virtual MethodVirtual method makes some default functionality. In other words, virtual methods are being implemented in the base class and can be overridden in the derived class. • public class A • { • public virtual int Calculate(int a, int b) • { • return a + b; • } • } • public class B: A • { • public override int Calculate(int a, int b) • { • return a + b + 1; • } • }
  • 49. C,Abstract Method Abstract Method is the method with no implementation and is implicitly virtual. You can make abstract method only in Abstract class. public void abstract DoSomething(int a);
  • 50. D,Partial Method A partial method has its signature defined in one part of a partial type, and its implementation defined in another part of the type. • partial class A • { • partial void OnSomethingHappened(string s); • } • // This part can be in a separate file. • partial class A • { • // Comment out this method and the program • // will still compile. • partial void OnSomethingHappened(String s) • { • Console.WriteLine("Something happened: {0}", s); • } • }
  • 51. E,Extension Method • Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. Extension methods are used to add some functionality to given type.
  • 52. • public static class ExtensionMethods • { public static string UppercaseFirstLetter(this string value) • { • if (value.Length > 0) • { • char[] array = value.ToCharArray(); • array[0] = char.ToUpper(array[0]); • return new string(array); • } • return value; • } } • class Program • { • static void Main() • { • // • // Use the string extension method on this value. • // • string value = "deeksha sharma"; • value = value.UppercaseFirstLetter(); • Console.WriteLine(value); • } • }
  • 53. F,Instance Method :An instance method operates on a given instance of a class, and that instance can be acessed as this.
  • 54. g.Static Method • This belongs to the type, it does not belong to instance of the type. You can access static methods by class name. • • You can put static method in static or non- static classes. The only difference is that static methods in a non-static class cannot be extension methods. Static often improves performance.
  • 56. Enums • In C#, enum is a value type data type. The enum is used to declare a list of named integer constants. • It can be defined using the enum keyword directly inside a namespace, class, or structure. • The enum is used to give a name to each constant so that the constant integer can be referred using its name. • An enum is used to create numeric constants in the .NET framework. All the members of enum are enum type. There must be a numeric value for each enum type.
  • 58. Enum example Enum months {January,February,March,April} Static void main(string [] args) { Int num=(int)months.April; Console.writeline(num); }
  • 59. Namespace • Namespaces in C# are used to organize too many classes so that it can be easy to handle the application. • In a simple C# program, we use System.Console where System is the namespace and Console is the class. To access the class of a namespace, we need to use namespacename.classname. We can use using keyword so that we don't have to use complete name all the time. • NameSpace is the Logical group of types or we can say namespace is a container (e.g Class, Structures, Interfaces, Enumerations, Delegates etc.), example System.IO logically groups input output related features , System. Data. SqlClient is the logical group of ado.net Connectivity with Sql server related features.
  • 61. Class • Classes are the user defined data types that represent the state and behaviour of an object. State represents the properties and behaviour is the action that objects can perform. • • All classes have a base type of System.Object. • The default access modifier of a class is Internal. • The default access modifier of methods and variables is Private
  • 62. Abstract Class • An Abstract class is a class that provides a common definition to the subclasses and this is the type of class whose object is not created. • Abstract classes are declared using the abstract keyword. • We cannot create an object of an abstract class. • If you want to use it then it must be inherited in a subclass. • An Abstract class contains both abstract and non-abstract methods. • The methods inside the abstract class can either have an implementation or no implementation. • We can inherit two abstract classes; in this case the base class method implementation is optional. • An Abstract class has only one subclass. • Methods inside the abstract class cannot be private.
  • 63. • Public abstract void geek() • { • // method geek is an abstract • } • Abstract Method: A method which is declared abstract, has no “body” and declared inside the abstract class only. • abstract class gfg • Abstract Class: This is the way to achieve the abstraction in C#. An Abstract class is never intended to be instantiated directly. This class must contain at least one abstract method, which is marked by the keyword or modifier abstract in the class definition. The Abstract classes are typically used to define a base class in the class hierarchy.
  • 64. Using system Public abstract class program{ Public abstract void sample(); } Public geek1:program{ Public overide sample(){ Console.writeline(“Geek 1program”);} Public geek2:program{ Public override sample(){ Console.writeline(“Geek 2 program”);} Public class main_method{ Public static void main(){ Program g; g=new geek1(); g.sample(); g=new geek2(); g.sample(); }}
  • 65. Partial Classes • A partial class is a special feature of C#. It provides a special ability to implement the functionality of a single class into multiple files and all these files are combined into a single class file when the application is compiled. • A partial class is created by using a partial keyword. This keyword is also useful to split the functionality of methods, interfaces, or structure into multiple files. • Syntax :public partial classname • { • code • }
  • 66. Examples • Public partial class Geeks{ private string author_name,private int Total_articles;} Public geeks(string a,int t){ This.author_name=a; This.Total_articles=t;} Public partial class Geeks{ Public void display{ Console.writeline(“Author Name is”+author_name); Console.writeline(“Total articls is ”+Total_articles); } }
  • 67. • public class Geeks { • private string Author_name; • private int Total_articles; • public Geeks(string a, int t) • { • this.Authour_name = a; • this.Total_articles = t; • } • public void Display() • { • Console.WriteLine("Author's name is : " + Author_name); • Console.WriteLine("Total number articles is : " + Total_articles); • } • }
  • 68. Sealed class • Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as a sealed class, this class cannot be inherited. • In C#, the sealed modifier is used to declare a class as sealed. In Visual Basic .NET, NotInheritable keyword serves the purpose of sealed. If a class is derived from a sealed class, compiler throws an error. If you have ever noticed, structs are sealed. You cannot derive a class from a struct. Syntax:sealed class SealedClass { }
  • 69. using System; class Class1 { static void Main(string[] args) { SealedClass sealedCls = new SealedClass(); • int total = sealedCls.Add(4, 5); • Console.WriteLine("Total = " + total.ToString()); • } • } • // Sealed class • sealed class SealedClass • { • public int Add(int x, int y) • { • return x + y; • } • }
  • 70. • class X { • protected virtual void F() { Console.WriteLine("X.F"); } • protected virtual void F2() { • Console.WriteLine("X.F2"); } } • class Y : X { sealed protected override void F() { • Console.WriteLine("Y.F"); } • protected override void F2() { • Console.WriteLine("X.F3"); } } • class Z : Y { // Attempting to override F causes compiler error CS0239. • // protected override void F() • { Console.WriteLine("C.F"); • } • // Overriding F2 is allowed. • protected override void F2() • { • Console.WriteLine("Z.F2"); • } • }
  • 71. Static Class • A C# static class is a class that can't be instantiated. The sole purpose of the class is to provide blueprints of its inherited classes. A static class is created using the "static" keyword in C#. A static class can contain static members only. You can‘t create an object for the static class. • Advantages of Static Classes • If you declare any member as a non-static member, you will get an error. • When you try to create an instance to the static class, it again generates a compile time error, because the static members can be accessed directly with its class name. • The static keyword is used before the class keyword in a class definition to declare a static class. • A static class members are accessed by the class name followed by the member name.
  • 73. Static Members • A static class is basically the same as non static class.But one difference is it cannot instantiated.In other words you cannot use the new operator to create the variable of class type.Because there is no instance variable you can acess the member of static class By using the class Itself.if you have a static class named utilityclass that has a public static method MethodA. • You can call the method • Utilityclass.MethodA()
  • 74. Instance Members • An instance data member of a class is recreated each time when a new instance of the class is created and it is associated with that instance only.
  • 76. 13.Inheritance • In C#, inheritance is a process in which one object acquires all the properties and behaviors of its parent object automatically. In such way, you can reuse, extend or modify the attributes and behaviors which is defined in other class. • In C#, the class which inherits the members of another class is called derived class and the class whose members are inherited is called base class. The derived class is the specialized class for the base class. • Code reusability: Now you can reuse the members of your parent class. So, there is no need to define the member again. So less code is required in the class.
  • 77. 1.Single Level Inheritance: When one class inherits another class, it is known as single level inheritance • .
  • 78. Multi Level:When one class inherits another class which is further inherited by another class, it is known as multi level inheritance in C
  • 79. Hierarchical inheritance: In this type of inheritance, there is one parent class and the other derived classes inherit the same parent class to achieve this inheritance.
  • 80. Multiple Inheritance using interface •
  • 81. Hybrid Inheritance • Hybrid Inheritance(Through Interfaces): It is a mix of two or more of the above types of inheritance. Since C# doesn’t support multiple inheritance with classes, the hybrid inheritance is also not possible with classes. In C#, we can achieve hybrid inheritance only through Interfaces.
  • 83. Polymorphisam • Polymorphism is a Greek word, meaning "one name many forms". In other words, one object has many forms or has one name with multiple functionalities. • "Poly" means many and "morph" means forms. Polymorphism provides the ability to a class to have multiple implementations with the same name • There are two types of polymorphism in C#: 1.Static / Compile Time Polymorphism. 2.Dynamic / Runtime Polymorphism.
  • 85. Static or Compile Time polymorphisam • It is also known as Early Binding. Method overloading is an example of Static Polymorphism. In overloading, the method / function has a same name but different signatures. It is also known as Compile Time Polymorphism because the decision of which method is to be called is made at compile time. Overloading is the concept in which method names are the same with a different set of parameters. Here C# compiler checks the number of parameters passed and the type of parameter and make the decision of which method to call and it throw an error if no matching method is found.
  • 87. Dynamic or Runtime Polymorphisam • Dynamic / runtime polymorphism is also known as late binding. Here, the method name and the method signature (number of parameters and parameter type must be the same and may have a different implementation). Method overriding is an example of dynamic polymorphism. Method overriding can be done using inheritance. With method overriding it is possible for the base class and derived class to have the same method name and same something. The compiler would not be aware of the method available for overriding the functionality, so the compiler does not throw an error at compile time. The compiler will decide which method to call at runtime and if no method is found then it throws an error.
  • 89. Method Overriding & Method Hiding • Method Overriding is a technique that allows the invoking of functions from another class (base class) in the derived class. Creating a method in the derived class with the same signature as a method in the base class is called Method Overriding. In simple words, Overriding is a feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes. When a method in a subclass has the same name, same parameters or signature and the same return type(or sub-type) as a method in its super-class, then the method in the subclass is said to override the method in the super-class.
  • 91. Method Hiding • In Method Hiding, you can hide the implementation of the methods of a base class from the derived class using the new keyword. Or in other words, in method hiding, you can redefine the method of the base class in the derived class by using the new keyword.
  • 94. Method Overloading • Method Overloading is the common way of implementing polymorphism. It is the ability to redefine a function in more than one form. A user can implement function overloading by defining two or more functions in a class sharing the same name. C# can distinguish the methods with different method signatures. i.e. the methods can have the same name but with different parameters list • Different ways of doing overloading methods- Method overloading can be done by changing: • The number of parameters in two methods. • The data types of the parameters of methods. • The Order of the parameters of methods.