Tag Archives: Func

Linq Extension Methods Versus Linq Query Language… DEATHMATCH

Today I was writing out an example of why the extension methods are for the most part better to use than the querying language. Go figure I would find a case where that’s not entirely true. Say you are using these three funcs: Func<User, String> userName = user => user.UserName; Func<User, Boolean> userIDOverTen = user [...]

Leave a comment Continue Reading →

Cannot Resolve Method, Can’t Infer Return Type, and Funcs

So ran into this today and the answer was actually a lot easier to understand than I thought it would be. Say you want to order a list of objects by a number. Seems simple. Now if you have been paying attention you would know I like using Funcs. Func<SomeClass, Int32> orderByNumber = currentClass => [...]

Leave a comment Continue Reading →

Uhg It Won’t End

Still on the readability thing, but there was a second argument in the post that inspired now what is three posts of my own here. The question was should you use Linq based on people saying it’s more readable, therefore just making it syntax sugar. foreach(Item current in itemList) { itemNameList.Add(current.Name); } Versus var itemNameList [...]

Leave a comment Continue Reading →

What Is Readable Addon

Quick thought too about which to use due to readability: var you = from factor in seansAwesomeness select new FactorLite { Amount = amount; }; or you could do: Func<Person, FactorLite> selectFactorLite = currentFactor => new FactorLite { Amount = currentFactor.Amount }; seansAwesomeness.Select(selectFactorLite); I guess it’s a matter of preference, but the first seems way [...]

Leave a comment Continue Reading →

What Is Readable

So a couple of posts I read recently have been about readability of Linq, more so Linq query expressions versus the Linq methods. Don’t know what I mean? Expression: var result = from knowledge in Sean select knowledge.Linq; As opposed to: var result = Sean.Select(knowledge => knowledge.Linq); Personally I would replace the lambda expression with [...]

Leave a comment Continue Reading →