Lambda expressions are not delegates

There is allot of confusion gotesing on in the .NET community when it comes to Lambda expressions. Allot of blog posts out there claiming that Lambdas are simply another way to write delegates, or rather anonymous delegates. Lambda expressions and delegates are two different things. Delegates are always delegates. Even anonymous delegates will always be…More

.NET Stateful delegates and memoization

I’ve been planning to write about stateful anonymous delegates for quite some time now so here I go :-) The common perception of anonymous delegates is that they are stateless functions used for filtering and transformations and similar things. What is less known is that anonymous delegates can hold state by binding to local variables.…More

Linq Expressions – Access private fields

In this post I will show how you can use Linq Expressions to access private(or public) class fields instead of using Reflection.FieldInfo. Normally when you want to access a field by its name on a type you have to resort to reflection. You will end up with something like this: FieldInfo field = MyType.GetField(“someField”,BindingFlags.NonPublic | ….…More