I have a problem that has been nagging me for some time now and I can't find the answer.
I need to obtain the name of the property that is being referenced in a Lambda Expression. I would provide the lambda expression to a method that would return a string. For example if I have:
x => x.WeirdPropertyName
then the method would return:
"WeirdPropertyName"
I have read that it can be done with expression trees, but the answer has eluded me.
Thanks for any help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…