1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Public Class Form1
Private tonDict As New Dictionary(Of String, Action(Of String))
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
tonDict.Add("aa", AddressOf Sub1)
tonDict.Add("bb", AddressOf Sub2)
tonDict.Add("cc", AddressOf Sub3)
Call ListeDesFichier(tonDict)
End Sub
Sub ListeDesFichier(ledictionnaire As Dictionary(Of String, Action(Of String)))
'blablabla
For Each de In ledictionnaire
Dim action As Action(Of String) = CType(de.Value, Action(Of String))
Dim s As String = CType(de.Key, String)
action.Invoke(s)
Next
'blablabla
End Sub
Sub Sub1(NomDeFichier As String)
MsgBox(NomDeFichier)
End Sub
Sub Sub2(NomDeFichier As String)
MsgBox(NomDeFichier)
End Sub
Sub Sub3(NomDeFichier As String)
MsgBox(NomDeFichier)
End Sub
End Class |
Partager