Re: [ADVANCED-DOTNET] generics and Mixins

2007-12-06 Thread Mark Nicholls
I want to add interfaces to classes in code. class FooAnd : Foo,X { } . . . . . void XYZ() { FooAnd fooAndBar = new FooAnd(); } you can almost do it by wrapping X with an interface decorator interface Iam { X GetX(); } class FooAnd : Foo,Iam { } but it's not quite the same. ===

Re: [ADVANCED-DOTNET] generics and Mixins

2007-12-05 Thread Greg Young
What are you hoping to accomplish there... There are other methods of doing this like runtime code generation. On Dec 5, 2007 7:56 AM, Mark Nicholls <[EMAIL PROTECTED]> wrote: > I suppose there's no way to do > > interface Foo : X > { > } > > in any sensible mannerof course there isn't but you

Re: [ADVANCED-DOTNET] generics and Mixins

2007-12-05 Thread Peter Ritchie
In general, an interface "inheriting" for any type isn't supported. An interface can only "implement" another interface. There's no way to constrain a type parameter to "interfaces". Then, of course, you can't use a type parameter as a base class/interface anyway...

[ADVANCED-DOTNET] generics and Mixins

2007-12-05 Thread Mark Nicholls
I suppose there's no way to do interface Foo : X { } in any sensible mannerof course there isn't but you never know (extension methods are almost therebut not quite). === This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and