我想问一下这样定义泛型还有意义吗? public class VM_MixedType
{
public int Id { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public string ImageUrl { get; set; }
public enumContentType ContentType { get; set; }
public DateTime CreateDate { get; set; }
public int LeadOrder { get; set; }
public int Priority { get; set; }
public MixedObject OriginObject { get; set; }
} public class MixedObject<T>:MixedObject
{
public T MObject { get; set; }
}
public class MixedObject
{
public object MObject { get; set; }
}
实现new VM_MixedType() { Id = refer.Id, OriginObject = new MixedObject<Article>() { MObject = refer } }
{
public int Id { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public string ImageUrl { get; set; }
public enumContentType ContentType { get; set; }
public DateTime CreateDate { get; set; }
public int LeadOrder { get; set; }
public int Priority { get; set; }
public MixedObject OriginObject { get; set; }
} public class MixedObject<T>:MixedObject
{
public T MObject { get; set; }
}
public class MixedObject
{
public object MObject { get; set; }
}
实现new VM_MixedType() { Id = refer.Id, OriginObject = new MixedObject<Article>() { MObject = refer } }
{
public int Id { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public string ImageUrl { get; set; }
public enumContentType ContentType { get; set; }
public DateTime CreateDate { get; set; }
public int LeadOrder { get; set; }
public int Priority { get; set; }
public MixedObject OriginObject { get; set; }
} public class MixedObject<T>:MixedObject
{
public override T MObject { get; set; }
}
public class MixedObject
{
public virtual object MObject { get; set; }
}
如果没有意义,我想实现OriginObject 的类型是动态的应该怎么来做?
帮忙看看
public class VM_MixedType<T>
{
public int Id { get; set; }
public string Title { get; set; }
public string Summary { get; set; }
public DateTime CreateDate { get; set; }
public int LeadOrder { get; set; }
public int Priority { get; set; }
public MixedObject<T> OriginObject { get; set; }
}public class MixedObject<T>
{
public T MObject { get; set; }
}
List<VM_MixedType<T>>