' Definujemy delegat.
Public Delegate Function ProcessFunction(ByVal StringIn As String) As String

Module Module1

    Sub Main()
        ' Tworzymy delegat.
        Dim MyDelegate As ProcessFunction

        ' Zmienna wskazuje delegat do CapitalizeName()
        MyDelegate = AddressOf CapitalizeName

        ' Wywołujemy metodę CaptilizeName() za pośrednictwem delegata.
        Dim UCaseName As String
        UCaseName = MyDelegate("samantha jones")

        ' Wyświetlamy wynik.
        Console.WriteLine(UCaseName)

        ' Wstrzymanie programu z oczekiwaniem na Enter.
        Console.ReadLine()
    End Sub

    Public Function CapitalizeName(ByVal Name As String) As String
        Return Name.ToUpper()
    End Function

End Module

