There is the following type
public class Nested1
{
public int Id {get; set;}
public string Name {get; set;}
public string Address {get; set;}
}
public class Nested2
{
public int Id {get; set;}
public Nested1 Nested {get; set;}
}
I would like to get through type.GetProperties a list of all properties of class Nested2 and its subclass Nested1 so the list would be Nested2.Id, Nested2.Nested, Nested1.Id, Nested1.Name, Nested1.Address. I have done this using recursion, is there possible a stack approach? Thank you
I don’t know this way is right or wrong what you are using,but you can use reflection instead of it.
USE This LINK TO REFER,hope so ,IT will help you