Give a class like below, how can i find the name of one particluar property?
public class Student
{
public int Grade
{
get;
set;
}
public string TheNameOfTheGradeProperty
{
get
{
return ????
}
}
// More properties..
}
So i would like to return the string "Grade" from the TheNameOfTheGradeProperty property. The reason i'm asking is that i do not want to use a hardcoded string, but rather a lambda expression or something else.
How can i acheive this?