I need to get fields and properties in order as declared in class.
Here is my existing code:
MemberInfo[] l_arrMemberInfoTemp = m_target.GetType().GetMembers(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
The above code returns all properties first and then all fields.
MyClass.cs
int myInt;
int myIntProp{get;set;}
float myFloat;
int myFloatProp{get;set;}
Current output:
myIntProp <----- Property comes first.
myFloatProp <----- Property comes first.
myInt
myFloat
Expected output:
myInt
myIntProp
myFloat
myFloatProp
Aucun commentaire:
Enregistrer un commentaire