假设我们有以下两个类的定义:
public class ParentClass
{
public ChildClass[] Children{ get; set; }
}
public class ChildClass
{
public int Id{ get; set; }
}
ParentClass我们可以迭代using的属性System.Type,但我无法在 dotnet core 中找到一种方法来确定 的非数组Children类型ChildClass。例如,我希望始终能够通过以下测试:
Type childType = GetChildTypeOf(typeof(ParentClass));
Assert.True(childType == typeof(ChildClass));
那么,应该如何GetChildTypeOf(...)实施呢?
互换的青春
javascript中从一个对象取部分属性给另一个对象
django在读取数据库后返回的是一个对象,如何将对象中的字段(属性)读出?
获取指定javaBean对象的属性值
如何枚举JavaScript对象的属性?
相关分类