Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying To Understand Delegates
Message
 
À
01/01/2008 23:14:16
Handi Rusli
PT. Alam Sumbervita
Jakarta, Indonésie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01278832
Message ID:
01279010
Vues:
20
Thanks for the book reference. I'll get it right away.



>Hi Kevin,
>
>Did you know about object references in VFP ?
>
>
>Local myText as TextBox
>
>myText = thisform.text1
>myText.Value = "Hello"
>
>
>well, you have to see Delegates as Method references. When you invoke a delegate, it means that you invoke one or more method(s).
>
>I am like you, I am a VFP Developer trying to understand through the lens of VFP.
>
>If you don't mind, I suggest you to read C# School eBook at http://www.programmersheaven.com/download/50118/download.aspx This free ebook help me a lot how to see C# from the beginners perspective.
>
>Just my 0.2 cents :-)
>
>
>>Thanks. althought I'm still sorta fuzzy. Sorry for the confusion. I'm still looking C# throughg the lens of VFP.
>>
>>See my notes in line.
>>
>>
>>
>>// I understand this. It's the event declaration
>>public event EventHandler MyFooBar;
>>
>>// I get this
>>if (this.MyTextBox.Text == "FOO")
>>
>>      // I looked up the EventArgs class on MSDN. It states:
>>      //
>>      // "This class contains no event data; it is used by events that do not pass state
>>      // information to an event handler when an event is raised. If the event handler
>>      // requires state information, the application must derive a class from this class
>>      // to hold the data."
>>      //
>>      // So this creates and passes a default EventArgs class because OnMyFooBar
>>      // takes an EventArgs parameter, correct?
>>	this.OnMyFooBar(new EventArgs());
>>
>>
>>// Lastly, this raises the MyFooBar event:
>>protected virtual void OnMyFooBar(EventArgs e)
>>{
>>        // This is don't get at all. MyFooBar is an event definition. How can it be Null?
>>        // What would make it not null?
>>	if MyFooBar != null)
>>		MyFooBar(this, e);
>>}
>>
>>
>>
>>This I need help with:
>>
>>
>>
>>// Can you translate this into english for me?
>>this.oMyControl.MyFooBar += new System.EventHandler(this.oMyControl_MyFooBarHandler);
>>
>>// This is the function to run when the event is raised, correct?
>>private void oMyControl_MyFooBarHandler(object sender, System.EventArgs e)
>>{
>>	// whatever your code needs to be
>>}
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform