Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Initialize VAR in C Sharp

Article:
Viewed:  764 
Posted On:  14/06/2015 20:39:20 
How we can Initialize VAR in c# ? 

 

While working with var in c# if you need to initialize var then normally we think like below:

var qq=null;

If we do like above then we will get below error:

1.png

Image 1.

So to solve this use initialize your var like below:

As you can see I want to store a List in my var:

2.png

Image 2.

It depends what you want to store in your list: I f you want string then use below:

string y = null;

var qq = y;

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us