473,511 Members | 16,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interface question...

I have a quick question regarding the use of interfaces...

Assume I have a class A that needs to interact with another class B.
Classes A nd B are in different assemblies.

Now, in order to assure that the interaction between classes A and B works
properly, class A assumes that class B implements a certain interface I.

Where is the best place to define interface I? What assembly should it be
defined in? Are there any best practices for doing this?

Thanks!
Nov 15 '05 #1
6 1279
In article <u0**************@TK2MSFTNGP11.phx.gbl>, e@mail.com says...
I have a quick question regarding the use of interfaces...

Assume I have a class A that needs to interact with another class B.
Classes A nd B are in different assemblies.

Now, in order to assure that the interaction between classes A and B works
properly, class A assumes that class B implements a certain interface I.

Where is the best place to define interface I? What assembly should it be
defined in? Are there any best practices for doing this?

Thanks!


If there are circular dependencies between the assemblies if it goes
into one of them, try it in a separate assebmly, assuming there are no
other dependencies

--
Thanks
Mark mm
Nov 15 '05 #2
"craig" <e@mail.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
I have a quick question regarding the use of interfaces...

Assume I have a class A that needs to interact with another class B.
Classes A nd B are in different assemblies.

Now, in order to assure that the interaction between classes A and B works
properly, class A assumes that class B implements a certain interface I.

Where is the best place to define interface I? What assembly should it be
defined in? Are there any best practices for doing this?


Without knowing the context, it's hard to say. What about putting the
interface in a common assembly?

--
-Jimmy
Nov 15 '05 #3
craig wrote:
Where is the best place to define interface I? What assembly should
it be defined in? Are there any best practices for doing this?


Since the assembly name becomes part of the type name for your interface,
you'll want to define the interface in a third assembly and reference it in
the other two.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #4
Thanks for the input. I appreciate it.

I am still not sure I completely understand the logic behind the issue. But
our project has a common assembly where we are putting alot of miscellaneous
common classes, etc. I will go ahead and put the interface there and see
how it plays out.

Thanks again!

"Frank Oquendo" <fr****@acadxpin.com> wrote in message
news:OL**************@TK2MSFTNGP10.phx.gbl...
craig wrote:
Where is the best place to define interface I? What assembly should
it be defined in? Are there any best practices for doing this?
Since the assembly name becomes part of the type name for your interface,
you'll want to define the interface in a third assembly and reference it

in the other two.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 15 '05 #5
Hi Craig,

The short answer will be, create another assembly ( project on VS.NET ) and
declare there your common interfaces.

For a longer better explanation see Skeet's explanation of plugs ins at :
http://www.yoda.arachsys.com/csharp/plugin.html

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"craig" <e@mail.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
I have a quick question regarding the use of interfaces...

Assume I have a class A that needs to interact with another class B.
Classes A nd B are in different assemblies.

Now, in order to assure that the interaction between classes A and B works
properly, class A assumes that class B implements a certain interface I.

Where is the best place to define interface I? What assembly should it be
defined in? Are there any best practices for doing this?

Thanks!

Nov 15 '05 #6
Excellent article. That really helped to clear things up for me.

Thanks!

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:#s**************@TK2MSFTNGP12.phx.gbl...
Hi Craig,

The short answer will be, create another assembly ( project on VS.NET ) and declare there your common interfaces.

For a longer better explanation see Skeet's explanation of plugs ins at :
http://www.yoda.arachsys.com/csharp/plugin.html

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"craig" <e@mail.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
I have a quick question regarding the use of interfaces...

Assume I have a class A that needs to interact with another class B.
Classes A nd B are in different assemblies.

Now, in order to assure that the interaction between classes A and B works properly, class A assumes that class B implements a certain interface I.

Where is the best place to define interface I? What assembly should it be defined in? Are there any best practices for doing this?

Thanks!


Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
5280
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++...
26
2070
by: Marius Horak | last post by:
As in subject. Thanks MH
4
8570
by: jm | last post by:
Consider: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconwhenshouldiimplementinterfacesinmycomponent.asp // Code for the IAccount interface module. public...
20
4223
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
13
3220
by: John Salerno | last post by:
Hi all. I have a question about interfaces now. According to the book I'm reading, when you implement an interface, the class or structure has to declare all the methods that the interface...
6
6065
by: John Salerno | last post by:
I understand how they work (basically), but I think maybe the examples I'm reading are too elementary to really show their value. Here's one from Programming C#: #region Using directives ...
10
667
by: Joe | last post by:
My question is more an OOD question. I know *how* to implement both abstract classes and interfaces. Here's my question - under what circumstacnes does one use an abstract class and under what...
4
2837
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
5
1658
by: Colin McGuire | last post by:
Hi all, when I write the class below Private Class employee End Class and then add the line "Implements IVF" which is an interface I have written, the IDE modifies my code to display
52
20812
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.