-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Anand_2004
Message 1 in Discussion
Hi Folks , As per my earlier post on C# Orcas I am going to share my
experience on the various enhancements of C# 3.0 .Today I am going to talk
about implicity local variables . Implicitly typed local variable provides
the facility to declare the variable without specify the type , compiler will
implicitly declare the type of the variable based on the value initialize .To
declare the local variable use the keyword called var for example var
name= Hello MUGH;
// this is equals to
string name = Hello MUGH; //define a generic type
var myList = new List<int>();
myList.Add(100); Implicitly local variable makes our job very easy but it
work with few constraints like Implicitly type declaration must have
initialize to a value
// value must initialize
var x; // its a compile time error The initializer expression
cannot be the null type var x = null;
The initializer cannot be an object or collection initializer by itself, but
it can be a new expression that includes an object or collection initializer.
// collection initializer not allowed
var x = { 1, 2, 3}; // it can be declare as
var numbers = new int[] { 1, 2, 3};
Cheers
Anand
https://anandkumar2004.wordpress.com
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]