Tag: linq
-
Function Name Instead of Lambda in Linq Functions
I did not realize that functions can fill in for predicates directly without lambda notation. To illustrate, consider the following: void Main() { var words = new List<string>() { “therapists”, “s words”, “slang”, “mustache”, “sean connery” }; var s_words = words.Where(w => w.StartsWith(“s” ,StringComparison.CurrentCultureIgnoreCase)); foreach(var word in s_words) { Console.WriteLine(word); } } It works, but […]
-
IEnumerable and Linq
I was helping someone on StackOverFlow.com and ran into an interesting issue. The post is here. I explained the issue in my response, but I’ll try to sum up. Newer collection types implement IEnumerable(Of T) as opposed to the original IEnumerable interface. For example, System.Generic.List(Of T) implements IEnumerable(Of T), so the following is valid without […]