C# Basics: Delegates


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. delegate string DelegateTest(string str);
  2.  
  3. DelegateTest delTest = new DelegateTest(Class1.Hello);
  4. Console.WriteLine(delTest("LOL"));
  5.  
  6. class Class1{
  7. ...
  8. public static string Hello(string msg) {
  9. return "Hello " + msg;
  10. }
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.