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?
You can get B
type using BType.PropertyType
:
A AType = new A();
var BType = AType.GetType().GetProperty("child");
var childPropertyType = BType.PropertyType.GetProperty("childProperty");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.