473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

can event properties be part of the interface?

I have about 100 of this sort in my main clas, and I would like to put
them into interface:

in Main class:
public event onFooHandler OnFoo { add { m_dispatcher.onFoo +=
value; } remove { m_dispatcher.onFoo -= value; } }
....
Oct 8 '08 #1
2 1626
On Wed, 08 Oct 2008 11:59:58 -0700, puzzlecracker <ir*********@gmail.com>
wrote:
I have about 100 of this sort in my main clas, and I would like to put
them into interface:

in Main class:
public event onFooHandler OnFoo { add { m_dispatcher.onFoo +=
value; } remove { m_dispatcher.onFoo -= value; } }
....
First of all, there's no such thing as an "event property".

Secondly, are you asking whether the interface can include the
_implementation_? Or you just want to include the event as required as
part of some other class's implementation of the interface?

Thirdly, this is yet another one of those "why don't you just write the
code and see what the compiler says?" questions. So, I recommend you just
write the code and see what the compiler says. If you have some specific
question about the results once you've put that much effort into the
question, please feel free to come back and post _that_.

For what it's worth, I'm not convinced that having 100 of _anything_ in an
interface makes much sense. The whole point of an interface is to declare
some small subset of functionality that can be implemented by a variety of
disparate classes. It's hard to believe that any collection of 100
somethings could exist in any disparate classes; that's more likely to be
something implemented only in a single class hierarchy, and so it's more
likely that sort of thing belongs in a base class rather than an interface.

Pete

Oct 8 '08 #2
You only need

public event FooHandler Foo;

"On" is a Delphi syntax :-)

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com
Oct 8 '08 #3

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

Similar topics

3
by: Lachlan Hunt | last post by:
Hi, I've been looking up lots of documentation and trying to work out a cross-platform method of capturing a keyboard event and working out which key was pressed. From what I can find, there...
2
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...
11
by: Alx Sharp | last post by:
Hello group... I've created a collection class that implements the following interfaces: IBindingList, IList, ICollection, IEnumerable and ITypedList: abstract class DataCollectionBase :...
2
by: Alex Sedow | last post by:
Why interface-event-declaration does not support multiple declarators like event-declaration? Grammar from C# spec: variable-declarators: variable-declarator variable-declarators ","...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
1
by: sundog2000 | last post by:
I am writing my first VB.net program and I am struggling to figure out how to attach an event to a method, when the event is part of an interface that the class implements. I have declared a...
3
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...
3
by: =?Utf-8?B?TkVXMi5ORVQ=?= | last post by:
I have a static event declared in a C++ ref class, that can then be handled in a VB app. I'm trying to expose the static event through the interface that the C++ ref class implements so the VB app...
4
by: FullBandwidth | last post by:
I have been perusing various blogs and MSDN pages discussing the use of event properties and the EventHandlerList class. I don't believe there's anything special about the EventHandlerList class in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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,...
0
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...

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.