// EF (Model) project
class EntityBase { } // base class for all types
class Person : EntityBase // specific implementation for type Person
// ViewModel project
class EditableViewModel<T> where T : EntityBase // base class for all viewmodel types
class PersonViewModel : EditableViewModel<Person>
class CollectionViewModel<T> where T : EditableViewModel<EntityBase> // base class that handles CRUD operation on EditableViewModel<T> collections
// everything up to this point work. I am unable to create specific instance of CollectionViewModel<>
class AllPersonsViewModel : CollectionViewModel<PersonViewModel>
我该如何做到这一点?通用类型作为泛型类型参数
问题是在最后的评论,fyi。 – usr
也许他没有时间阅读评论,但确实有时间倒计时。然后他决定删除他的评论,发现它“不适合”。 :) – Goran