Click here to Skip to main content
15,914,066 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to detect display type : CRT or LCD ? Pin
scoket5-Dec-10 22:39
scoket5-Dec-10 22:39 
GeneralRe: how to detect display type : CRT or LCD ? Pin
fjdiewornncalwe6-Dec-10 1:44
professionalfjdiewornncalwe6-Dec-10 1:44 
AnswerRe: how to detect display type : CRT or LCD ? Pin
Eddy Vluggen5-Dec-10 22:30
professionalEddy Vluggen5-Dec-10 22:30 
GeneralRe: how to detect display type : CRT or LCD ? Pin
scoket5-Dec-10 22:41
scoket5-Dec-10 22:41 
QuestionSend SMS Pin
anishkannan5-Dec-10 20:30
anishkannan5-Dec-10 20:30 
AnswerRe: Send SMS Pin
Luc Pattyn5-Dec-10 21:26
sitebuilderLuc Pattyn5-Dec-10 21:26 
AnswerRe: Send SMS Pin
db7uk6-Dec-10 23:25
db7uk6-Dec-10 23:25 
QuestionEvents in Interfaces Pin
Richard Andrew x645-Dec-10 15:38
professionalRichard Andrew x645-Dec-10 15:38 
I'm having trouble understanding how to declare events inside interfaces so that the event handler receives my objects that are sent when I raise the events.

The documentation makes it look as if I am limited to using EventArgs as my args parameter. Is this true?

What if I want my args parameter to be my own derived object?

// The interface shown in the docs
    public interface IDrawingObject
    {
        // Raise this event before drawing
        // the object.
        event EventHandler OnDraw;
    }

// The implementer class shown in the docs
    public class Shape : IDrawingObject, IShape
    {
        // Create an event for each interface event
        event EventHandler PreDrawEvent;
        event EventHandler PostDrawEvent;

        // I left out some stuff here
    }

// The subscriber class
    public class Subscriber1
    {
        // References the shape object as an IDrawingObject
        public Subscriber1(Shape shape)
        {
            IDrawingObject d = (IDrawingObject)shape;
            d.OnDraw += new EventHandler(d_OnDraw);
        }

        void d_OnDraw(object sender, EventArgs e)
        {
            Console.WriteLine("Sub1 receives the IDrawingObject event.");
        }
    }

The difficult we do right away...
...the impossible takes slightly longer.

AnswerRe: Events in Interfaces Pin
Not Active5-Dec-10 16:30
mentorNot Active5-Dec-10 16:30 
GeneralRe: Events in Interfaces Pin
Richard Andrew x645-Dec-10 16:34
professionalRichard Andrew x645-Dec-10 16:34 
Questionevents between two threads Pin
igalep1325-Dec-10 8:03
igalep1325-Dec-10 8:03 
AnswerRe: events between two threads Pin
Luc Pattyn5-Dec-10 8:45
sitebuilderLuc Pattyn5-Dec-10 8:45 
GeneralRe: events between two threads Pin
igalep1325-Dec-10 8:55
igalep1325-Dec-10 8:55 
GeneralRe: events between two threads Pin
Luc Pattyn5-Dec-10 9:42
sitebuilderLuc Pattyn5-Dec-10 9:42 
GeneralRe: events between two threads Pin
igalep1325-Dec-10 9:48
igalep1325-Dec-10 9:48 
GeneralRe: events between two threads Pin
Luc Pattyn5-Dec-10 9:57
sitebuilderLuc Pattyn5-Dec-10 9:57 
AnswerRe: events between two threads Pin
Not Active5-Dec-10 9:28
mentorNot Active5-Dec-10 9:28 
GeneralRe: events between two threads Pin
igalep1325-Dec-10 9:38
igalep1325-Dec-10 9:38 
GeneralRe: events between two threads Pin
Not Active5-Dec-10 9:56
mentorNot Active5-Dec-10 9:56 
GeneralRe: events between two threads [modified] Pin
igalep1325-Dec-10 10:47
igalep1325-Dec-10 10:47 
AnswerRe: yield Pin
Luc Pattyn5-Dec-10 11:25
sitebuilderLuc Pattyn5-Dec-10 11:25 
GeneralRe: yield Pin
Not Active5-Dec-10 11:32
mentorNot Active5-Dec-10 11:32 
GeneralRe: yield Pin
Pete O'Hanlon5-Dec-10 11:33
mvePete O'Hanlon5-Dec-10 11:33 
GeneralRe: yield Pin
Luc Pattyn5-Dec-10 11:37
sitebuilderLuc Pattyn5-Dec-10 11:37 
GeneralRe: yield Pin
igalep13211-Dec-10 0:45
igalep13211-Dec-10 0:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.