-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: Munaf
Message 4 in Discussion
Explain with example what are anonymous
methods ?
For using delegates, you are forced to create a
method or classes, to avoid it microsoft has introduced a concept of anonymous
methods.
Anonymous methods is a new feature in C# 2.0 that
lets you define an anonymous or nameless methods called by
delegates.
The Anonymous methods is defined in-line and not
as a member methods of any class.
Examples :
Using Conventional way
Class ConventionalClass
{
Delegate void
TestDelegate()
public void
InvokeMethod()
{
TestDelegate objDelegate = new TestDelegate(TestMethod) ;
objDelegate() ;
}
private void
TestMethod()
{
MessageBox.Show("Using Conventional Method !!!!") ;
}
}
Using Anonymous Method
:
Class AnonymousClass
{
Delegate void
TestDelegate()
public void
InvokeMethod()
{
TestDelegate objDelegate = Delegate()
{
MessageBox.Show("Using
Anonymous Method !!!!!") ;
}
objDelegate
;
}
for more clearification on Partial Class, Static Class, Anonymous methods,
pls. visit
http://msdn.microsoft.com/msdnmag/issues/04/05/c20/
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]