using System;
public delegate void myDelegate();
class Program
{
static void Method()
{
Console.WriteLine("call me with Delegate");
}
static void Main()
{
myDelegate ob = new myDelegate(Method);
ob();
Console.ReadKey();
}
}
|
Public Delegate Sub myDelegate()
Class Program
Private Shared Sub Method()
Console.WriteLine("call me with Delegate")
End Sub
Private Shared Sub Main()
Dim ob As New myDelegate(AddressOf Method)
ob()
Console.ReadKey()
End Sub
End Class
|