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?
1 Answer