Am I correct that I can't do Interface Inheritance in C#?

What I was trying to do is have one interface (which was part of my
framework) and then have the application-specific interface inherit from
this interface and extend it as needed. I thought my application would only
need a reference to the application-specific interface (different assembly)
and that the application would have a reference to the framework-specific
interface (again, different assembly). Something like the following:

Client App ---> references Application assembly (with application
interface) --> which references Framework Assembly (with framework
interface)

ex.

Framework Interface:
public interface IRemoteObject

{

DataSet GetData();

DataSet SaveData(DataSet dataSet);

}


App-specific interface:

public interface IMethRemoteObject : IRemoteObject

{

DataSet GetPatientData();

}

However, the Client App can't see the framework interface unless I put a
reference in the CLient App to the Framework Assembly.


I guess the proper way to handle this is to put a reference to both
interfaces, and not inherit one interface from another.

I just want to make sure I am understanding what is going on (or not going
on in this case).

Thanks,
Mark

Re: Interface inheritance? by John

John
Fri Jun 11 08:12:09 CDT 2004

"Mark Essex" <messex@nospam.netalytics.com> wrote in message
news:ekwwaS7TEHA.2324@TK2MSFTNGP10.phx.gbl...
> Am I correct that I can't do Interface Inheritance in C#?
>
> What I was trying to do is have one interface (which was part of my
> framework) and then have the application-specific interface inherit from
> this interface and extend it as needed. I thought my application would
only
> need a reference to the application-specific interface (different
assembly)
> and that the application would have a reference to the framework-specific
> interface (again, different assembly). Something like the following:
>
> Client App ---> references Application assembly (with application
> interface) --> which references Framework Assembly (with framework
> interface)
>
> ex.
>
> Framework Interface:
> public interface IRemoteObject
>
> {
>
> DataSet GetData();
>
> DataSet SaveData(DataSet dataSet);
>
> }
>
>
> App-specific interface:
>
> public interface IMethRemoteObject : IRemoteObject
>
> {
>
> DataSet GetPatientData();
>
> }
>
> However, the Client App can't see the framework interface unless I put a
> reference in the CLient App to the Framework Assembly.
>
>
> I guess the proper way to handle this is to put a reference to both
> interfaces, and not inherit one interface from another.
>
> I just want to make sure I am understanding what is going on (or not going
> on in this case).

You can do interface inheritance, but you still need to reference both
assemblies.
--
John Saunders
johnwsaundersiii at hotmail



Re: Interface inheritance? by Jon

Jon
Fri Jun 11 08:15:27 CDT 2004

Mark Essex <messex@nospam.netalytics.com> wrote:
> Am I correct that I can't do Interface Inheritance in C#?

No.

> What I was trying to do is have one interface (which was part of my
> framework) and then have the application-specific interface inherit from
> this interface and extend it as needed. I thought my application would only
> need a reference to the application-specific interface (different assembly)
> and that the application would have a reference to the framework-specific
> interface (again, different assembly). Something like the following:

<snip>

That's got nothing to do with inheritance - it's just that you need to
reference *all* the appropriate assemblies in a sort of recursive
manner. So long as you reference both of the assemblies in question,
there should be no problem with one interface inheriting from another.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too