I am trying to create a delegate (as a test) for:
Public Overridable ReadOnly Property PropertyName() As String
My intuitive attempt was de
This is good idea
Test t = () => e.PropertyName; // C# 3.0
But take care if your are doing something like this:
List> funcs = new List>();
foreach (var e in Collection)
funcs.Add(new Func(() => e.Property));
Calling this:
foreach(var f in funcs)
f();
Will always return value of property of the last object in Collection
In this case you should call method:
foreach (var e in Collection)
funcs.Add(new Func(e.GetPropValue));