473,508 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Do event members belong in interfaces?

Do event members belong in interfaces? I have used events in interfaces to
report state changes and they work well. However; I really never see event
members in any of the framework interfaces. So, is there some reason for
this lack of event members in the framework interfaces beside the fact that
they may not be needed? Is it a performance issue or a design issue or maybe
there is not problem with this design?
Jul 21 '05 #1
3 1214
I can't attest to your specific design, but I have used events in
interfaces. I do not see a problem with them if there is a true need for
them. If you want to force all classes that implement the interface to use
those event, then do for it.

"Darren" <Da****@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
Do event members belong in interfaces? I have used events in interfaces to report state changes and they work well. However; I really never see event members in any of the framework interfaces. So, is there some reason for
this lack of event members in the framework interfaces beside the fact that they may not be needed? Is it a performance issue or a design issue or maybe there is not problem with this design?

Jul 21 '05 #2
System.ComponentModel.IComponent has an event declaration: Disposed. There are probably others in the framework that have event
declarations too.

If it's appropriate for your design pattern, there is no problem adding an event field to an Interface declaration.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:eS**************@TK2MSFTNGP14.phx.gbl...
I can't attest to your specific design, but I have used events in
interfaces. I do not see a problem with them if there is a true need for
them. If you want to force all classes that implement the interface to use
those event, then do for it.

"Darren" <Da****@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
Do event members belong in interfaces? I have used events in interfaces

to
report state changes and they work well. However; I really never see

event
members in any of the framework interfaces. So, is there some reason for
this lack of event members in the framework interfaces beside the fact

that
they may not be needed? Is it a performance issue or a design issue or

maybe
there is not problem with this design?


Jul 21 '05 #3
Thanks for your comments. As I said I have used events in interfaces before
and just wanted to make sure there was not some issue I did not know about.
I did have a look at FX Cop and did not have a problem with this either.

Again, thanks.

"Dave" wrote:
System.ComponentModel.IComponent has an event declaration: Disposed. There are probably others in the framework that have event
declarations too.

If it's appropriate for your design pattern, there is no problem adding an event field to an Interface declaration.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:eS**************@TK2MSFTNGP14.phx.gbl...
I can't attest to your specific design, but I have used events in
interfaces. I do not see a problem with them if there is a true need for
them. If you want to force all classes that implement the interface to use
those event, then do for it.

"Darren" <Da****@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
Do event members belong in interfaces? I have used events in interfaces

to
report state changes and they work well. However; I really never see

event
members in any of the framework interfaces. So, is there some reason for
this lack of event members in the framework interfaces beside the fact

that
they may not be needed? Is it a performance issue or a design issue or

maybe
there is not problem with this design?



Jul 21 '05 #4

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

Similar topics

2
22293
by: Derrick | last post by:
How does one declare an event within an interface, so that every class which implements that interface must implement that event? I think I just need to specifiy the actual event as I would a...
74
4987
by: Mark | last post by:
Hello Friends Please check the code below. One in C# and other in VB .Net In C# I am not able to access a static property by an instance variable, but in VB I can do it easily. The Error is ...
6
1776
by: Charles Law | last post by:
I have a class, which implements an interface. Let's say, that the interface looks something like Public Interface IEventSinks Sub ValueChanged(sender As Object, e As ValueChangedEventArgs) Sub...
13
3023
by: CJ Taylor | last post by:
Alright on a DataRow you have the BeginEdit method Where can I catch an event that tells me that method is being fired or does one exist? Thanks, -CJ
3
240
by: Darren | last post by:
Do event members belong in interfaces? I have used events in interfaces to report state changes and they work well. However; I really never see event members in any of the framework interfaces. ...
3
6856
by: axr | last post by:
Having trouble with Serilization of objects that contain members which are of type Interface eg public class SomeClass { ISomeInterface1 itf1; ClassType1 ct1; ISomeInterface2 itf2;
5
2009
by: mmkhajah | last post by:
Hi, I am trying to have a set of base classes and interfaces of an application framework in their own assembly. That way, concrete implementations of the API will reference that assembly and...
3
11539
by: steve | last post by:
Hi all, I want to be able to hirearchally define event delegate (declarations) WITHIN interfaces. Unfortunatelly C# 1 doesn't appear to support it. How does the following look as a...
15
4192
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5633
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
5056
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
4713
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
3204
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
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
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
424
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.