The .NET languages pick up a number of enhancements as a result of updates made to the Common Language Runtime (CLR). Although there are a few specific enhancements to Visual Basic and to C#, the big (and majority of) advancements made in 2008 apply to both languages. Therefore, we cover language enhancements as a group and provide examples in both languages. If a given addition is language specific, it will be indicated as such. The .NET language additions covered here include the following:
- Local Type Inference (also called Implicit Typing)
- Object Initializers
- Extension Methods
- Anonymous Types
- Lambda Expressions
- Partial Methods
- Language Integrated Query (LINQ)
- Friend Assemblies
- XML Language Support (VB only)
- Unused Event Arguments (VB only)
- Automatically Implemented Properties (C# only)
Many of these new language features serve to support an important new feature, Language Integrated Query (LINQ). However, each language feature is useful on its own and should be understood clearly.
Infer a Variable’s Data Type Based on Assignment
Create an Object and Set Its Properties with a Single Line of Code
Add Methods to Existing Classes
Create an Instance of a Nonexistent Class
Write Simple, Unnamed Functions Within Your Code
Add Business Logic to Generated Code
Access and Query Data Using the .NET Languages
Split an Assembly Across Multiple Files
Work with XML Directly Within Your Code
Remove Unused Arguments from Event Handlers (VB Only)
Create an Automatically Implemented Property (C# Only)
|
0 comments
Post a Comment