C
colin
John Barrett said:To create an event
1. create a "public delegate <method prototype>;" outside the class that
will have the event... inside the class -- add a "public event <delegate
method name> <event name>;"
2. any place in the class where you want to fire the event, add "if
(<event name> != null) <event name>(delegate params);"
3. in any class that you want to handle the event, add "object.<event
name> += handler;"... the IDE will create the handler stub for you if you
hit tab twice after the +=
the delegate defines the parameters that will be passed, the event
statement defines the variable that will contain the list of handlers to
be invoked when the event is fired. Since delegates are typed, you can
pass any number/type of parameters that you like -- no limitations![]()
cool thanks, although my autoreset works ok but il def look at that too.
although I initialy forgot to reset the thing if I didnt have to wait
then i forgot to check to not reset it if there was more there,
id forget my head if .. oh wait ...
Re sccanf == ya -- that doesnt really fit into the java/c# paradigm --
you've probably already found this or something similar -- but here is a
regex based sccanf for c#
http://www.codeproject.com/csharp/CsScanf.asp
Yeah I saw that in a google search, scaned through about 10- pages of stuff
and thought geez
my brain is already starting to melt trying to take in new lang dev system
etc.
all i want to do is 1 line like sscanf(s,"%d:%s:%d,%d|%d,%d\n"...
I could porobably write a whole sscanf function in less time it takes to
read and digest all that.
I remember long ago it only took me a few hours to write a whole sprintf()
wich was reentrant friendly.
sscanf was realy out of place in c++ too, I gues its time it went, but not
in quite this way.
Instead I wrote a function wich just tryParse 1 variable at a time with
given delimter and skip chars,
and wich advances the string to the next unread point. I only need int and
string so no biggy.
works like a charm as the format can change depending on what %s is anyway.
Im sure regex is realy powerful though.
Its interesting that c# is an awkward name as # is an often an illegal char
eg in wikipedia as a title.
havnt got the hang of thinking csharp yet :s
Aso I couldnt find c# in any of the .lang newsgroups ?
This thread has become purly software now,
I hope its not trying the patience of those who like to make noises
about keeping this group on topic too much.
But im probably on my way to seeing it through now anyway so thanks for you
much appreciated help
Theres probably a lot il not know about c# even after ive finished.
Colin =^.^=