Answers for "Create a delegate and create multiple methods as user1, user2, user3 so on in a class named Subscribers, which can be referenced using delegate."

C#
3

delegate function c#

// Create the Delgate method.
public delegate void Del(string message);

// Create a method for a delgate.
public static void DelegateMethod(string message)
{
  Console.WriteLine(message);
}

// Instatiate the delegate.
Del hadler = DelegateMethod;

// Call the delegate.
hadler("Hello World");

// Output
// Hello World
Posted by: Guest on March-23-2020

C# Answers by Framework

Browse Popular Code Answers by Language