Skip to main content
Rolled back edits that should have been comments, added correction.
Source Link
Keith
  • 156.9k
  • 82
  • 314
  • 453

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHander( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHander; 

You can even use Linqlambda syntax and the intellisense will all be done for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHander( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHander; 

You can even use Linq syntax and the intellisense will all be done for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHander( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHander; 

You can even use lambda syntax and the intellisense will all be done for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 
Rollback to Revision 1
Source Link
Keith
  • 156.9k
  • 82
  • 314
  • 453

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHandlerLowestCommonHander( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHandler;LowestCommonHander; 

You can even use lambdaLinq syntax and the intellisense will even infer the right typesall be done for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHandler( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHandler; 

You can even use lambda syntax and the intellisense will even infer the right types for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHander( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHander; 

You can even use Linq syntax and the intellisense will all be done for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 
s/Hander/Handler/, correct reference to lamba method syntax to be “lambda” rather than “Lynq”
Source Link
Blumer
  • 5k
  • 2
  • 36
  • 47

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHandler( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHandler; 

You can even use lambalambda syntax and the intellisense will even infer the right types for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHandler( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHandler; 

You can even use lamba syntax and the intellisense will even infer the right types for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 

C# supports some inherited covariance for event delegates, so a method like this:

void LowestCommonHandler( object sender, EventArgs e ) { ... } 

Can be used to subscribe to your event, no explicit cast required

gcInt.MyEvent += LowestCommonHandler; 

You can even use lambda syntax and the intellisense will even infer the right types for you:

gcInt.MyEvent += (sender, e) => { e. //you'll get correct intellisense here }; 
s/Hander/Handler/, correct reference to lamba method syntax to be “lambda” rather than “Lynq”
Source Link
Loading
Source Link
Keith
  • 156.9k
  • 82
  • 314
  • 453
Loading