471,618 Members | 1,077 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

C# - Interface EVent Question


I have an event in an interface, how do I implement this event in a
class? I have tried implements keyword and does not work.

public enum ActionEnum {Added, Removed};

public class ListChangedEventArgs : System.EventArgs
{
public Employee Item;
public ActionEnum Action;
}

public delegate void ListChangedEventHandler(object sender,
ListChangedEventArgs e);

public interface IServices
{
/// <summary>
/// Gets a list of all emplyees currently held on the server.
/// </summary>
/// <returns></returns>
System.Collections.ArrayList GetAllEmplyees( );

/// <summary>
/// Occurs when the list of employees maintained on the server
changes.
/// This is mainly triggered when a new employee is added or an
existing one
/// is removed from the list.
/// </summary>
event ListChangedEventHandler ListChanged;

}

Feb 17 '06 #1
1 2997
Hi Jhon,

You dont need implement the event method. If you want to associate
event with a method in your class, use below statements in your class.

event ListChangedEventHandler ListChanged;

ListChanged += new ListChangedEventHandler(ListChanged_EventHandler);

Cheers,
Kris

Feb 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Ash | last post: by
2 posts views Thread by Derrick | last post: by
3 posts views Thread by Chua Wen Ching | last post: by
2 posts views Thread by COLIN JACK | last post: by
4 posts views Thread by Anthony Yott | last post: by
1 post views Thread by SStory | last post: by
11 posts views Thread by Wayne Pedersen | last post: by
2 posts views Thread by puzzlecracker | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

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.