Current Function/Property Name Using Reflection
-
Hi Is it possible to get the current function or property name using reflection? If it is then how?
Regards Shajeel
string name = System.Reflection.MethodBase.GetCurrentMethod ().Name;
-
string name = System.Reflection.MethodBase.GetCurrentMethod ().Name;
-
Its the same.. Properties are methods in IL code. However , you will have to remove "set_" and "get_" prefixes that are applied to property methods. eg if you have a property called "Foo" and you use the code I supplied in the "setter" you will get "set_Foo" and in the getter you will get "get_Foo"
-
Its the same.. Properties are methods in IL code. However , you will have to remove "set_" and "get_" prefixes that are applied to property methods. eg if you have a property called "Foo" and you use the code I supplied in the "setter" you will get "set_Foo" and in the getter you will get "get_Foo"