eventhandler

  • Thread starter Thread starter Maarten
  • Start date Start date
M

Maarten

might be a stupid question but
can i set an eventhandler for a variable?

regards Maarten
 
Maarten,

Do you mean for any variable? No, you can not. If the instance of the
type of the variable exposes events, then you can attach to those, but in
general, no, you can not be notified when an arbitrary variable changes.

Hope this helps.
 
thanks,

yes i mean for all variables

for examle
string test = "test" ;

and then fix an eventhandler that starts if the content of the variable
changes.



Nicholas Paldino said:
Maarten,

Do you mean for any variable? No, you can not. If the instance of the
type of the variable exposes events, then you can attach to those, but in
general, no, you can not be notified when an arbitrary variable changes.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Maarten said:
might be a stupid question but
can i set an eventhandler for a variable?

regards Maarten
 
You could create a custom object and add event - handling to it. For an
example, see Darth Pedro's "ArrayList with Events" at godotnet.com:

http://www.gotdotnet.com/Community/...mpleGuid=044E3F1B-3F23-4849-9F0B-692A451A7AFB

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




Maarten said:
thanks,

yes i mean for all variables

for examle
string test = "test" ;

and then fix an eventhandler that starts if the content of the variable
changes.



Nicholas Paldino said:
Maarten,

Do you mean for any variable? No, you can not. If the instance of the
type of the variable exposes events, then you can attach to those, but in
general, no, you can not be notified when an arbitrary variable changes.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Maarten said:
might be a stupid question but
can i set an eventhandler for a variable?

regards Maarten
 
Thanks, just what i needed
regards Maarten



Peter Bromberg said:
You could create a custom object and add event - handling to it. For an
example, see Darth Pedro's "ArrayList with Events" at godotnet.com:

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=044E3
F1B-3F23-4849-9F0B-692A451A7AFB

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




Maarten said:
thanks,

yes i mean for all variables

for examle
string test = "test" ;

and then fix an eventhandler that starts if the content of the variable
changes.



message news:[email protected]...
Maarten,

Do you mean for any variable? No, you can not. If the instance
of
the
type of the variable exposes events, then you can attach to those, but in
general, no, you can not be notified when an arbitrary variable changes.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

might be a stupid question but
can i set an eventhandler for a variable?

regards Maarten
 
Back
Top