Friday, March 2, 2012

Lambda Expressions

Does C# absolutely need Lambda's? I dont think so , but it sure helps with LINQ
this is more C# like
PropertyInfo[] p = t.GetProperties();
            IEnumerable<string> names = p.Where(nms => nms.Name.StartsWith("S")).Select(nms => nms.Name);   
than: 
var names = from nms in p
            where nms.Name.StartsWith("S")             
            select nms.Name;

No comments:

Post a Comment