Let's say i got this:
public class Foo{
public string Bar;
}
Then i want to create a 'static reflection' to retrieve value of Bar like this:
public void Buzz<T>(T instance, Func<T, string> getProperty){
var property = getProperty(instance);
}
That should work. But what if Foo looks like this?
public class Foo{
public static string Bar = "Fizz";
}
Can i retrieve value of Bar without passing instance of Foo?
Usage should look like:
var barValue = Buzz<Foo>(foo=>foo.Bar);