c# - What is the return type for an Event in .NET? -
i know what's default return type event: says event has not return type; others says event has return type. thanks.
it depends on type of delegate declare event with. "typical" events declared delegate of type eventhandler
or eventhandler<teventargs>
returns void
, nothing forbids declaring event different type of delegate... if not principle of least surprise (pols).
"typical":
public event eventhandler myvoidevent;
"custom":
public delegate bool mybooldelegate(object sender, eventargs e); public event mybooldelegate myboolevent;
normally put "return values" in eventargs
object, that's why events don't need return values... can if they're told to.
Comments
Post a Comment