473,667 Members | 2,664 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 1222
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****@discuss ions.microsoft. com> wrote in message
news:A7******** *************** ***********@mic rosoft.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.Componen tModel.ICompone nt 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..jwaon line..com
-----------------------------------------------------------------------
"Peter Rilling" <pe***@nospam.r illing.net> wrote in message news:eS******** ******@TK2MSFTN GP14.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****@discuss ions.microsoft. com> wrote in message
news:A7******** *************** ***********@mic rosoft.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.Componen tModel.ICompone nt 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..jwaon line..com
-----------------------------------------------------------------------
"Peter Rilling" <pe***@nospam.r illing.net> wrote in message news:eS******** ******@TK2MSFTN GP14.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****@discuss ions.microsoft. com> wrote in message
news:A7******** *************** ***********@mic rosoft.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
22303
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 function, but what about the delegate? Up to now, all my interfaces have only dealt with properties and functions. Here's basically what I want to do (for example): public interface IFoo
74
5038
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 Static member 'ClassInCS.ABC.MyInt' cannot be accessed with an instance reference; qualify it with a type name
6
1783
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 StateUpdated(sender As Object, e As StateUpdatedEventArgs) End Interface In practice, the interface contains many more event handlers like this, but you get the picture.
13
3037
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. 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?
3
6870
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
2013
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 implement the abstract classes and interfaces. The problem is that some parts of the API are "internal" in the sense that they are internal to the implementation. If I declare these parts as internal in the API, the implementations will not be...
3
11551
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 work-around? Are there better ways of doing this?
15
4219
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 testing for support of particular eventTypes - the DOM 2 Events Interface DocumentEvent says that if the eventType is not supported, it throws a DOM exception. This makes testing rather tough - if you try something like: if (document &&...
0
8458
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8565
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2779
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 we have to send another system

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.