我是一个新手,VB,和我有难以理解以下(遗留代码)类的声明实际上意味着:递归泛型类型声明在VB.Net
Public MustInherit Class ModelBase(Of T As {ModelBase(Of T, TIdType), New}, TIdType)
谁能解释一下上面的?还有一个相关的ModelBaseCollection
:
Public MustInherit Class ModelBaseCollection(Of TCollection As {ModelBaseCollection(Of TCollection, TModel, TIdType), New}, TModel As {ModelBase(Of TModel, TIdType), New}, TIdType)
Inherits Collection(Of TModel)
我很难理解为ModelBaseCollection
类的需求为ModelBase
类是一个泛型类型。
嗯......递归泛型。如果您了解C#,请看看这个:http://fernandof.wordpress.com/2007/09/23/recursive-generics-restrictions/ – 2011-03-23 19:19:21
[Curiously Recurring Template Pattern and generics constraints(C#)]( http://stackoverflow.com/questions/1327568/curiously-recurring-template-pattern-and-generics-constraints-c) – 2011-03-23 19:43:59