我正在尝试创建一个简单的DataContainer类,
public interface DataObject
{
string Name { get; set; }
uint ID { get; set; }
}
[Serializable()]
public class DataContainer<T> where T : DataObject
{
}
...但如果我希望DataContainer也继承DataObject - 我该怎么做?
答案 0 :(得分:3)
有什么问题
[Serializable()]
public class DataContainer<T> : DataObject where T : DataObject
{
public string Name
{
get { //implementation here }
set { //implementation here }
}
public uint ID
{
get { //implementation here }
set { //implementation here }
}
}