Skip to main content

Posts

Showing posts with the label Delete lines in dataTable using asp.net

ASP.Net Tips-Create object for delegate ,Paste data using code,Delete lines in dataTable

namespace Akadia.BasicDelegate { // Declaration public delegate void SimpleDelegate(); class TestDelegate { public static void MyFunc() { Console.WriteLine("I was called by delegate ..."); } public static void Main() { // Instantiation SimpleDelegate simpleDelegate = new SimpleDelegate(MyFunc); // Invocation simpleDelegate(); it's the object of delegate. } } } objectname.Eventname += new objectname.delegatename(functionname()); in this we are calling events by creating an object of that particular class providing events but when we attaching delegates we are not using the object name or we cannot use object name, instead we are using class name of that particular delegate provided . Delegate is neither meant to do any action nor to persist a value. so there is no need to access the delegate by an object. And we can even declare the delegate outside of the class. There is no significant in declaring the dele