- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
To Continue Learning Please Login
Login with Google