, - , . - . , - .
(, Reflection) . # - girly man - # 3.5, , , . - .
, - -, - . :
class ObjA {
public:
void memberfunc() {
}
};
ObjA instance1;
ObjA* instance2 = &instance1;
instance2->memberfunc();
ObjA , ( , ). - , , .
# Reflection . , , - -, , . , , , Reflection.
public static class Extensions {
public static string GetFirstPropertyName(this object obj) {
return obj.GetType().GetProperties()[0].Name;
}
}
public class Program {
public static void Main() {
int intVal = 5;
var name = (new {intVal}).GetFirstPropertyName();
}
}