4
Answers

events

srinath

srinath

15y
2.2k
1

Hi,
I am trying events and delegates in my program on google search I came to see one code snippet. I couldn't get that in to which variable the output is going. Please help me..
public
delegate void NumberArgumentHandle(object sender, NumberArgs args);
public
event NumberArgumentHandle NumberSelected
{
add
{
Events.AddHandler(key,
value);
}
remove
{
Events.RemoveHandler(key,
value);
}
}

double
x = double.MaxValue;
double
.TryParse((sender as Button).Text, out x);
if (x != double.MaxValue)
{
NumberArgs args = new NumberArgs(Convert.ToDouble((sender as Button).Text));
RaiseEvent(args);
}
public class NumberArgs : EventArgs
{
double number = double.MaxValue;
public NumberArgs(double number)
{
this.number = number;
}
public double Number
{
get { return number; }
}
}
Answers (4)