[program-l] Re: C# Help Please

  • From: "Corbett, James" <James.Corbett@xxxxxxxxxxxxxxx>
  • To: "'program-l@xxxxxxxxxxxxx'" <program-l@xxxxxxxxxxxxx>
  • Date: Mon, 21 Mar 2005 08:09:41 -0500

Ian and David:

If this were JAVA and thank God its not... You could chekc to see if the
isDisposedEventHandler returns a true or false.

Jim 

-----Original Message-----
From: Ian Sharpe [mailto:isforums@xxxxxxxx]
Sent: March 21, 2005 7:55 AM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: C# Help Please


Hi David,

Submission is defined as an Event. I think the test in the C# code is to see
whether an event handler has been assigned to this event. I think that in C#
this is how you test for this.

The test you are performing in VB.NET is simply  attempting to call this
event directly. I think you need to find out how you test whether an event
handler has been assigned to an event?

Sorry to be so vague but I'm still trying to get my head around delogates
and events!

Cheers
Ian

----- Original Message ----- 
From: "David Lant" <david.lant@xxxxxxxxxxxx>
To: <Program-L@xxxxxxxxxxxxx>
Sent: Monday, March 21, 2005 11:40 AM
Subject: [program-l] C# Help Please


> Hi all,
>
> Could someone familiar with C# let me know what the following code means
> please?   I'm trying to reproduce it in VB.NET.
>
> if (Submission != null)
> {
> Console.WriteLine("Broadcasting...");
> // Raise Event. This calls the remote listening
> method on all clients of this object.
> Submission(this, e);
> }
>
> When I try to code what I believe to be the VB equivalent:
>
> If Submission <> Nothing Then
> Console.WriteLine("Broadcasting...")
> Raise Submission(Me, e)
> End If
>
> I get the following error against the If statement:
>
> 'Public Event Submission(sender As Object, SubmitArgs As SubmitEventArgs)'
> is an event, and cannot be called directly. Use a 'RaiseEvent' statement
to
> raise an event.
>
> Which does make sense to me.  So I'm unclear as to how C# can reference an
> event like this, while VB cannot.  Have I misinterpreted the statement?
Is
> it that VB simply doesn't need to do this and can raise the event
> unconditionally?
>
> Thanks for any clarification that might be available.
>
> David Lant
>
> I.T. Consultant
> Consultancy & Development
> ICT Services
> Tel: (01392) 382464
>
> Devon County Council accepts no legal responsibility for the contents of
> this message. The views expressed do not reflect those of Devon County
> Council.
>
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** program-l-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: