Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
In c# event is a callback function. When a work is done, a value got changed, a part of a work is done and in other cases you could use an event to get the feedback. Event is higher version of Action. Action and event both must be invoked. Use it when you are making a file management software and in windows form application. Syntax : void event_name(object sender, EventArgs e) { } Example : void set_event(MyFile file) { file.OnDownloadComplete += complete; } void complete (object sender, EventArgs e) { //Download complete. } class MyFile { event OnDownloadComplete; //constructors, functions and other things... }
24th Nov 2016, 6:42 PM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar