I have to get property information for a specific property. I can use it:
foreach (Property InfoPage.GETProperties ()) in {if (p.Name == "MyProperty") {return p}} < / Code> < as type property property (MyProperty)
is there? Or am I comparing an unsafe string?
Cheers.
You can use the new nameof ()
operator which is C # 6 and Visual Studio 2015 is available. more information.
For your example, you will use it:
propertyfifferent result = type (myobacter). GetProperty (Namedf (Myobacter. MipPropt));
The compiler will convert nameof (MyObject.MyProperty)
to "MyProperty" string but gain the advantage of being able to redo the property name without profit Remember to change the strings because visual studio, reciprocity, and how to address the nameof ()
value refactor.
Comments
Post a Comment