Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Public Event Handlers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leslie Sanford - 07 Jan 2006 00:49 GMT
Is it considered bad style to make event handlers public? Something like
this:

public void Send(object sender, SomeEventArgs e)
{
   // Do stuff...
}

The idea is that by making the handlers public, a third party can
configure the flow of events through an application by attaching and
detaching objects with events to objects with event handlers. The
objects involved don't have to know about each other.

I can't find anything in the guidelines that say one way or the other.
Lloyd Dupont - 07 Jan 2006 03:24 GMT
I think that, wether or not the method is an event handler, the question is:
is it appropriate to make this method public?

difficult question...

my politic is the following:
I made as much as possible method public and virtual.
If calling a method require additional work to maintain the object in an
appropriate state (i.e. other method call are required not to break the
object) I make it protected or internal.
If the method just make no sense to the outside world (such as a utility
method) I make it private.

> Is it considered bad style to make event handlers public? Something like
> this:
[quoted text clipped - 10 lines]
>
> I can't find anything in the guidelines that say one way or the other.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.