Initialization vs Instantiation in C#

CsharpProgrammingServer Side Programming


When you assign a value to a variable when it is declared, it is called Initialization.

Here is an example −

int val = 50;

For array initialization, you may need a new keyword, whereas to initialize a variable, you do not need it.


When you create a new object in C# for a class using the new keyword, then it is called instantiation.

Use the new operator to instantiate a class in C#.

Here is an example showing two objects of Student class created using new keyword −

Student s1 = new Student();
Student s2 = new Student();
Published on 31-Aug-2018 13:11:22