Reputation: 796
Class A
{
public B child {get; set;}
}
Class B
{
public string childProperty {get; set;}
}
I am getting all property
var BType = AType.GetType().GetProperty("child");
I am able to get "Child" property of A, but how i can get "childProperty" from BType?
Upvotes: 0
Views: 458
Reputation: 125640
You can get B
type using BType.PropertyType
:
A AType = new A();
var BType = AType.GetType().GetProperty("child");
var childPropertyType = BType.PropertyType.GetProperty("childProperty");
Upvotes: 1