C Sharp 3
C Sharp 3
0
• Implicit variable declaration
• Anonymous Types
• Extension Methods
• Automatic Properties
• Object Initializers
• Collection Initializers
• Lambda Expressions
• Query Expressions
• Expression Trees
• LINQ to Collections
• LINQ to DataSet
• LINQ to SQL
• Partial Methods
• LINQ to XML
Implicit variable declaration
Implicit declaration
Only within method can declare this
Not even with interfaces also
Not even as parameter also
Take home of Implicit Variable
Note how the static method above has a "this" keyword before the first parameter
argument of type string. This tells the compiler that this particular Extension Method
should be added to objects of type “int".
Automatic Property
Note about that we aren't actually adding any logic in the getters/setters of
our properties – instead we just get/set the value directly to a field.
Automatic Properties
• When the C# "Orcas" compiler encounters an empty get/set
property implementation like above, it will now automatically
generate a private field for you within your class, and
implement a public getter and setter property implementation
to it.
Anonymous Types
Summary
• Lambda expressions
• Expression trees
• The keyword var, object and collection initialization, and
anonymous types
• Extension methods
• Partial methods
• Query expressions
Lambda Expressions