【发布时间】:2011-06-24 11:49:17
【问题描述】:
public class Access
{
public Entity eeee { get; set; }
public Permission<eeee.GetType()> pppp { get; set; }
}
public class Entity
{
}
public class Permission<T>
{
public bool CanView {get;set;}
public bool CanEdit {get;set;}
public bool CanDelete {get;set;}
}
public class Photo:Entity
{
}
public class PhotoPermission:Permission<Photo>
{
public bool CanTag {get;set;}
}
public class Video:Entity
{
}
public class VideoPermission:Permission<Video>
{
public bool CanFastForward {get;set;}
}
所以,如果eeee 的类型是Photo,那么pppp 的“类型”应该是Permission<Photo>
有没有类似eeee.GetType()的东西
【问题讨论】:
-
为什么不能把
public Permission<eeee.GetType()> pppp { get; set; }改成public Permission<Entity> pppp { get; set; }?