Anyone who has been doing any type of .net development knows you can subscribe (MSDN on event subscription) to an event as follows:Subscribe to an Non-Anonymous Method...// instance class w/ an event
myClass.DoSomething += HandleDoSomething
...// the method which handles the event
privat evoid HandleDoSomething( object s, args e )
{
myClass.DoSomething += (s, e) => {
// logic goes here
}And to unsubscribe from a non-anonymous method you would do the following ...
// instance class w/ an event
myClass.DoSomething -= HandleDoSomething
...Read more: Derik Whittaker
QR:
myClass.DoSomething += HandleDoSomething
...// the method which handles the event
privat evoid HandleDoSomething( object s, args e )
{
// Logic goes here
} Subscribe to an Anonymous Method...// instance class w/ an eventmyClass.DoSomething += (s, e) => {
// logic goes here
}And to unsubscribe from a non-anonymous method you would do the following ...
// instance class w/ an event
myClass.DoSomething -= HandleDoSomething
...Read more: Derik Whittaker
QR:
0 comments:
Post a Comment