本文整理汇总了VB.NET中System.Action代理的典型用法代码示例。如果您正苦于以下问题:VB.NET Action代理的具体用法?VB.NET Action怎么用?VB.NET Action使用的例子?那么恭喜您, 这里精选的代理代码示例或许可以为您提供帮助。
在下文中一共展示了Action代理的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: ShowValue
Public Delegate Sub ShowValue
Public Class Name
Private instanceName As String
Public Sub New(name As String)
Me.instanceName = name
End Sub
Public Sub DisplayToConsole()
Console.WriteLine(Me.instanceName)
End Sub
Public Sub DisplayToWindow()
MsgBox(Me.instanceName)
End Sub
End Class
Public Module testDelegate
Public Sub Main()
Dim testName As New Name("Koani")
Dim showMethod As ShowValue = AddressOf testName.DisplayToWindow
showMethod
End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:25,代码来源:Action
示例2: Name
Public Class Name
Private instanceName As String
Public Sub New(name As String)
Me.instanceName = name
End Sub
Public Sub DisplayToConsole()
Console.WriteLine(Me.instanceName)
End Sub
Public Sub DisplayToWindow()
MsgBox(Me.instanceName)
End Sub
End Class
Public Module testDelegate
Public Sub Main()
Dim testName As New Name("Koani")
Dim showMethod As Action = AddressOf testName.DisplayToWindow
showMethod
End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:23,代码来源:Action
示例3: Name
Public Class Name
Private instanceName As String
Public Sub New(name As String)
Me.instanceName = name
End Sub
Public Function DisplayToConsole() As Integer
Console.WriteLine(Me.instanceName)
Return 0
End Function
Public Function DisplayToWindow() As Integer
Return MsgBox(Me.instanceName)
End Function
End Class
Module LambdaExpression
Public Sub Main()
Dim name1 As New Name("Koani")
Dim methodCall As Action = Sub() name1.DisplayToWindow()
methodCall()
End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:24,代码来源:Action
注:本文中的System.Action代理示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论