Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Initialization vs Instantiation in C#
Initialization
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.
Instantiation
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();
Advertisements
