Hello,
I was wondering is it was possible to get the PropertyInfo directly from the code? What I mean is that I don't want to have a string base method call. To be clearer, I will show an example of What I would like to have in theory:
The goal is to have a compile time error is the property X is modified or removed. The syntax is not really a problem, but this example should show clearly what I'm looking for.Code:class Foo { public int X { get { return 0; } set {} } } // static method somewhere public static string Stringize(PropertyInfo pi) { // code here return myStr; } // the code I would like to write. string s = Stringize(Foo.X);




Reply With Quote