if events implemented representatives .net, indicate .event il section?


i've seen unequivocally good questions smoke-stack yield concerning delegates, events, .net doing twin features. doubt particular, "", assembled good answer explains separate points unequivocally well.



the answer above doubt creates point:




when announce field-like event
... compiler generates methods
private domain (of same type
delegate). within class,
ascribe elementaddedevent
you're referring field. outside
class, you're referring the
field




an msdn essay related same doubt ("") adds:




the thought lifting an eventuality is
precisely homogeneous invoking the
nominee represented eventuality
thus, there special language
constructs lifting events.




wanting inspect further, i built exam digest method perspective il an eventuality nominee collected to:



public category testclass
{
open eventhandler handler;
open eventuality eventhandler fooevent;

open testclass()
{ }
}


i approaching nominee domain handler eventuality fooevent accumulate roughly same il code, additional methods hang opening compiler-generated fooevent field. nonetheless il generated wasn't definitely i expected:



.class open automobile ansi beforefieldinit testclass
extends [mscorlib]system.object
{
.event [mscorlib]system.eventhandler fooevent
{
.addon instance vacant testclass::add_fooevent(class [mscorlib]system.eventhandler)
.removeon instance vacant testclass::remove_fooevent(class [mscorlib]system.eventhandler)
}

.method open hidebysig specialname rtspecialname instance vacant .ctor() cil managed
{
// constructor il hidden
}

.field private category [mscorlib]system.eventhandler fooevent
.field open category [mscorlib]system.eventhandler handler
}


since events zero some-more representatives compiler-generated add remove methods, i didn't design events treated anything some-more il. nonetheless supplement mislay methods tangible domain starts .event, .method normal methods are.



my ultimate questions are: events implemented simply representatives accessor methods, indicate carrying .event il section? couldn't implemented il but controlling .method sections? .event homogeneous .method?



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?