Re: Derive concrete type from generic type.
Daniel Petersson <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <E8FBCCA96548DD46A1AC748F17EEAD9C0E93D333EC@cefalo-mail01.cefalo.local> |
Frans is essentially right BUT... =) Some of us argue that inheriting classes such as List<T> to create new types is a bad thing. This discussion is more common in the JAVA community. Prior to completing your impl. I recomend that you read this java article about inheritence VS interface implementation. http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html Regards, Daniel ps the article is old and doesn't use generics but the problem I still the same ds ________________________________________ From: Discussion of development on the .NET platform using any managed language [[email protected]] On Behalf Of Frans Bouma [[email protected]] Sent: Tuesday, January 22, 2008 12: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