Some of the classes I have are as follow:
public class ObjectA
{
List <ObjectB> BCollection {get; set;}
}
public class ObjectB
{
String Name {get;set;}
List <ObjectC> CCollection {get; set;}
}
public class ObjectC
{
String Name {get; set;}
}
I need a method that recursively analyses the object and returns the list of field names as List. So that the list would contain:
ObjectA.BCollection,
ObjectA.BCollection.ObjectB.Name,
ObjectA.BCollection.ObjectB.CCollection,
ObjectA.BCollection.ObjectB.CCollection.ObjectC.Name.
The important thing is that at run time I do not know the type, I need to get the field names using reflection.
Aucun commentaire:
Enregistrer un commentaire