最終更新:2012-04-19 (木) 07:39:32 (4389d)  

VB.NET/デリゲート
Top / VB.NET / デリゲート

宣言

Delegate Sub デリゲートの名前 (仮引数リスト)

または

Delegate Function デリゲートの名前 (仮引数リスト) As 戻り値のデータ型

'デリゲートを宣言
Delegate Function SampleDelegate(ByVal x As Integer, ByVal y As Integer) As Integer

'SampleObject.SampleMethodをデリゲートに代入
'デリゲートに登録するときはAddressOf演算子を使う
Dim sample As SampleDelegate = AddressOf SampleObject.SampleMethod
Dim result As Integer = sample(2, 3)