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.
===
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
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...
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