Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Community Bloggers

What's Cool About VS2008: Extension Methods

What Are Extension Methods Extension Methods are a new feature in C# 3 and VB 9. To put it concisely, an extension method is a static helper function that can be invoked as if it were declared on any object that has a type matching that of its first parameter. It's pure syntactic sugar. Extension methods basically allow you to change this: List<String> injuredSecondary = new List<String> { "Mike Brown" , "Nathan Vasher" , "Charles Tillman" }; //Note that select is a static method on the System.Linq.Enumerable class IEnumerable<String> namesake = Enumerable.Select(injuredSecondary, x => x == "Mike Brown" ); To this: List<String> injuredSecondary = new List<String> { "Mike Brown" , "Nathan Vasher" , "Charles Tillman" }; //Note that we are calling select as if it were a method defined on the injuredSecondary object. IEnumerable<String> namesake = injuredSecondary.Select(x => x == Read More...
Published Tuesday, December 11, 2007 3:06 AM by Brownie Points
Filed under:

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us