aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

C# - Difference between Initialization and Instantiation

May 18, 2016

Here I will explain difference between initialization and instantiation in c#, with example or instantiation vs initialization in or how to instantiate and initialize a class in using c#, with example. In c# or instantiation means declaring object for class and initialization means assigning values to variables or setting initial values.



Initialization means assigning initial value to variables while declaring.

Example of Initialization

Following is the simple example of initialization in application.

  int a;//Declaration

  a = 10;//Initialization


  int a = 10;


Instantiation means defining or creating new object for class to access all properties like methods, operators, fields, etc. from class.


Following is the example of defining instantiation in application.

class sampleclass {
// your code
class Program
static void Main()
// Instantiating sampleclass
sampleclass sobj = new sampleclass();

If you observe above syntax we created new object by instantiating sampleclass class. By using new object sobj we can access all the methods and properties from sampleclass class.

I hope it helps you to understand difference between initialization and instantiation.

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Arjunsaran said...


Arjunsaran said...


Naveen Naghel said...


nwaf AH said...

Hi. Mr:Suresh Dasari.

Good job. but in the second example if i do like :
sampleclass sobj; // Is this Declaration
sobj = new sampleclass(); //and this Instantiating or Initialization

thank you..

Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.