如何找到我的 propertyinfo 类型?
我有以下代码:
public class EntityBase
{
public virtual void Freez(EntityBase obj)
{
//TO DO
}
我的示例中的任何类都继承自 EntityBase;像这样:
public class Person:EntityBase
{
public Person()
{
this.PersonAsset = new Asset { Title = "asset1" };
}
public string Name { get; set; }
public Asset PersonAsset{get;set;}
}
public class Asset : EntityBase
{
public string Title { get; set; }
}
我希望当我调用 person.Freez() 时,如果 person 具有一个类属性,例如 PersonAsset.the PersonAsset Freez() 方法引发; 我想我必须在 EntityBase Freez() 方法中使用反射。但是当我获得 PersonAsset 属性时 通过反射我怎样才能提高它的 Freez() 方法?或者我怎样才能找到我的 propertyinfo 是一个类?
I have the following code:
public class EntityBase
{
public virtual void Freez(EntityBase obj)
{
//TO DO
}
Any Class in my sample inherit from EntityBase; like this:
public class Person:EntityBase
{
public Person()
{
this.PersonAsset = new Asset { Title = "asset1" };
}
public string Name { get; set; }
public Asset PersonAsset{get;set;}
}
public class Asset : EntityBase
{
public string Title { get; set; }
}
I want when i invoke person.Freez() if person has a property that is a class such as PersonAsset.the PersonAsset Freez() method raised;
I think i must using reflection in EntityBase Freez() method.But when i get PersonAsset property
by reflection how can i raise its Freez() method?Or How can i find my propertyinfo is a Class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)