Introduction:
Here, In this articals we will see how to use compose Delegate in vb.net.
Delegate is a person acting for another person.A delegate can be define as a type safe function pointer.it encapsulate the memory address of a function in your code.whenever you create an event in the code you are using a delegate.A delegate declaration defines a class using the class system.Delegate as abase class Delegate methods are any functions (define in a class) whose signature matches the delegate signature exactly.
the delegate instance holds the refrence to delegate methods.the instance is used to invoke the methods indirectly.the most important feature of a delegate is it can be used to hold refrence to amethod of any class.the only requirement is that its signature must match the signature of the method.
Example:

Imports System

Imports System.Collections.Generic

Imports System.Linq

Imports System.Text

Delegate Function MyDeligate(ByVal s As String) As Object

Module Module1

Class MyTeam

Public Shared Function Hello(ByVal s As String) As Object

Return s

End Function

Public Shared Function Goodbye(ByVal s As String) As Object

Return s

End Function

Sub main()

Dim myDeligate1 As New MyDeligate(MyTeam.Hello)

Dim myDeligate2 As New MyDeligate(MyTeam.Goodbye)

Console.WriteLine(myDeligate1("Hello"))

Console.WriteLine(myDeligate2("Andrew"))
End Sub
End Class

Output of program:

deligate.gif