Written in front:
Used aspdotnet for some time, CSharp also know very little, today from the basic grammar of CSharp began to learn. Many of the content for the senior colleagues in the blog has been written, coupled with their own understanding, only to deepen their impression, if you can cnblog in the number, it is really flattered!
A. C # 3.0 Language main enhancement point
• Implicitly typed Local variables
• Extension methods
• Object and collection initializers
• Anonymous Type
lambda expression
• Query expression (LINQ)
• Expression tree
Two. Implicitly-typed local variables and arrays
First take a look at the example:
var i = 5;
var h = 23.56;
var s = "C Sharp";
var intArr = new[] { 1, 2, 3, 4 };
var a = new[] { 1, 10, 100, 1000 };
var str = new[] { "hello", null, "qun" };
var jcarr = new[]
{
new[] {1, 2, 3, 4},
new[] {5, 6, 7, 8}
};
var jcstr = new[]
{
new[] {"hello", "qun", "er", "wo"},
new[] {"xiang" , "ni", "le"}
};
var noname = new { name = "yaoyao", age = 24 };//匿名类型
var vlist = new List<int>();