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! 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
"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
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)
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)
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!
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!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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++...
|
by: Marius Horak |
last post by:
As in subject.
Thanks
MH
|
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...
|
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...
|
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...
| |
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
...
|
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...
|
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.
...
|
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
|
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...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
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...
| |