// 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