Re: Derive concrete type from generic type.
Brady Kelly <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
Thanks guys. This is what I originally thought, but I'm sorry to say I didn't research it nearly enough (it's deadline time), and last time I tried I must have done something wrong, because it only worked when I made both types generic. I really should have taken some more time out just to check it. > -----Original Message----- > From: Discussion of development on the .NET platform using any managed > language [mailto:[email protected]] On Behalf Of Frans > Bouma > Sent: 22 January 2008 01:38 PM > To: [email protected] > Subject: Re: [DOTNET-CLR] Derive concrete type from generic type. > > > Say I wanted a collection of Field objects, but with some extra > > functionality, say constraints on how fields can be added. I decided > > List<Field> is a good fit for most requirements, but want to derive a > > MyFieldList. To the best of my limited generics knowledge, I have to > derive > > a MyFieldList<T> anyway, but all my refinements in the child class > only > > refer to type Field, so the generic parameter is basically redundant. > Is > > there any way around this? > > public class MyFieldList : List<Field> > { > > ... > } > > FB > > =================================== > This list is hosted by DevelopMentor. http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com