考虑以下:
public class VideoContainer<T>
{
public string Name { get; set; }
//public List<VideoContainer<T>> VideoContainers { get; set; }
}
public class Perspective : VideoContainer<Perspective>
{
public List<VideoContainer<SourceContainer>> VideoContainers { get; set; }
}
我想确保VideoContainer<Perspective>.VideoContainers只能包含VideoContainer<SourceContainer>类型。
我将一个新Perspective对象添加到List<Perspective>带有三个的 a 中VideoContainers。问题是当我在列表中添加一个新的透视图时,之前添加Perspective.VideoContainers的为空。
为什么会这样?