c# - Explain this: CheckBox checkbox = (CheckBox)sender; -
while going through checkbox found there written
checkbox checkbox = (checkbox)sender   on checkbox1_checkedchanged event.
please explain means?
the line casts sender checkbox.
why?
the event handler signature checkedchanged event is:
checkchanged(object sender, eventargs e)   so, need cast sender checkbox if want use checkbox specific functionality - object doesn't have can use... 
this way checkbox variable can used checkbox id , operate on checkbox.
Comments
Post a Comment