V
Victor
Is it a way to discover, at the run time, the name of a property of an object?
In other words is it possible to create a method GetPropertyName, that takes
a property of an object and returns the name of that property? So:
string name = GetPropertyName(int.MaxValue); // returns “MaxValueâ€
string name = GetPropertyName(DateTime.Now); // returns “Nowâ€
(Something similar exists to
System.Reflection.MethodInfo.GetCurrentMethod().Name; that returns the name
of the current method)
In other words is it possible to create a method GetPropertyName, that takes
a property of an object and returns the name of that property? So:
string name = GetPropertyName(int.MaxValue); // returns “MaxValueâ€
string name = GetPropertyName(DateTime.Now); // returns “Nowâ€
(Something similar exists to
System.Reflection.MethodInfo.GetCurrentMethod().Name; that returns the name
of the current method)