Ashish,
In addition to the interface constraint that David showed.
There are also Class, Structure, New, and base class constraints:
See "Type of Constraints" at:
http://msdn2.microsoft.com/en-us/library/w256ka79.aspx
Also see:
http://msdn2.microsoft.com/en-us/library/t4xaz66w
Public Class MyGenericCollection(Of T As IEntity)
Public Class MyGenericCollection(Of T As {IEntity, Class})
Public Class MyGenericCollection(Of T As {IEntity, Structure})
Public Class MyGenericCollection(Of T As {IEntity, New})
Public Class MyGenericCollection(Of T As {IEntity, Control})
(where Control above is System.Windows.Forms.Control
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Ashish" <as*****@thisisjunk.com> wrote in message
news:Oq**************@TK2MSFTNGP15.phx.gbl...
|
| Iam wondering if it is possible to narrow down the type definition while
| specifying Generics,
|
| for example i want to create my collection class for a particular Type
| T, but i want this Type T to be of interface IEntity (something i
implement)
|
| so my collection would be like
|
| Public Class MyGenericCollection(Of T)
|
| public sub Save(myObj as T)
|
| end sub
| end class
|
|
| is it possible...
|
| TIA
|
|