Tutorials Infos - Anleitungen - Hilfe - Dreamcodes
 

Delegates

Sub main()
D(AddressOf Strings.StrReverse, "Teststring")
D(AddressOf Strings.UCase, "Teststring")
Dim foo As func = AddressOf Environment.GetEnvironmentVariable
D(foo, "PATH")
Dim tra As func = AddressOf baby
D(tra, "Dieser Text Eignet sich gut")
Console.ReadLine()
End Sub
Public Delegate Function func(ByVal s As String) As String
Sub D(ByVal f As func, ByVal x As String)
Console.WriteLine("{0} auf {1} = {2}", _
f.GetType.Name, x, f(x))
End Sub
Function baby(ByVal s As String) As String
Dim c() As Char = s.ToCharArray
Dim r As String
Dim i As Integer
For i = 0 To c.GetUpperBound(0)
Select Case c(i)
Case "A"c, "E"c, "I"c, "O"c, "U"c, _
"a"c, "e"c, "i"c, "o"c, "u"c
r &= c(i) & "b" & Char.ToLower(c(i))
Case Else
r &= c(i)
End Select
Next
Return r
End Function

 
ID: 1934
eingestellt am: 25.01.2010
Autor: Keine Angabe
Status zum lesen: Gast
gelesen: 6151
Webseite: www.dreamcodes.com
[Drucken]