Tag Archives: Lambda

Python: Lambda Expression Using a Dictionary

Quick hit for self future reference as usual, so I don’t care what you think: filter(lambda (key, value): key == “someValue”, directories.iteritems()) BAM!

Leave a comment Continue Reading →

Linq Join Extension Method and How to Use It…

I don’t like using the query syntax when it comes to Linq to AnythingButTheKitchenSink . Not sure why. Mostly, I guess, is that I seem to have a liking for Funcs and Actions to the point of stupidity and although you can work them into the query syntax, it just doesn’t look right. Now with [...]

4 Comments Continue Reading →

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 →

Another removing Lambda “trick”

And by trick, I mean I was too slow to realize that: someDictionary.Add(“Hi”, (Boolean doThis) => SomeMethod(doThis)); Can be done this way: someDictionary.Add(“Hi”, SomeMethod); Where the dictionary is: Dictionary<String, Action<Bool>> someDictionary; someDictionary = new Dictionary<String, Action<Bool>>(); And SomeMethod is: void SomeMethod(Boolean doSomething) { //Something is to be done! } Which as far as I know, [...]

Leave a comment Continue Reading →