当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET AppDomain.DoCallBack方法代码示例

本文整理汇总了VB.NET中System.AppDomain.DoCallBack方法的典型用法代码示例。如果您正苦于以下问题:VB.NET AppDomain.DoCallBack方法的具体用法?VB.NET AppDomain.DoCallBack怎么用?VB.NET AppDomain.DoCallBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.AppDomain的用法示例。


在下文中一共展示了AppDomain.DoCallBack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: PingPong

Public Module PingPong

    Private greetings As String = "PONG!"

    Sub Main()
        Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")

        greetings = "PING!"
        MyCallBack()
        otherDomain.DoCallBack(AddressOf MyCallBack)

        ' Output:
        '   PING! from defaultDomain
        '   PONG! from otherDomain
     End Sub

     Sub MyCallBack()
        Dim name As String = AppDomain.CurrentDomain.FriendlyName
        If name = AppDomain.CurrentDomain.SetupInformation.ApplicationName Then
            name = "defaultDomain"
        End If
        Console.WriteLine(greetings + " from " + name)
     End Sub

End Module 'PingPong
开发者ID:VB.NET开发者,项目名称:System,代码行数:25,代码来源:AppDomain.DoCallBack

示例2: PingPong

<Serializable> _
Public Class PingPong
     Private greetings As String = "PING!"

     Public Shared Sub Main()
        Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")

        Dim pp As New PingPong()
        pp.MyCallBack()
        pp.greetings = "PONG!"
        otherDomain.DoCallBack(AddressOf pp.MyCallBack)

        ' Output:
        '   PING! from defaultDomain
        '   PONG! from otherDomain
    End Sub

    Public Sub MyCallBack()
        Dim name As String = AppDomain.CurrentDomain.FriendlyName
        If name = AppDomain.CurrentDomain.SetupInformation.ApplicationName Then
            name = "defaultDomain"
        End If
        Console.WriteLine(greetings + " from " + name)
    End Sub

End Class
开发者ID:VB.NET开发者,项目名称:System,代码行数:26,代码来源:AppDomain.DoCallBack

示例3: PingPong

Public Class PingPong
    Inherits MarshalByRefObject

    Private greetings As String = "PING!"
   
    Public Shared Sub Main()
        Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")

        Dim pp As New PingPong()
        pp.MyCallBack()
        pp.greetings = "PONG!"
        otherDomain.DoCallBack(AddressOf pp.MyCallBack)

        ' Output:
        '   PING! from default domain
        '   PONG! from default domain
     End Sub

    ' Callback will always execute within defaultDomain due to inheritance from
    ' MarshalByRefObject
    Public Sub MyCallBack()
        Dim name As String = AppDomain.CurrentDomain.FriendlyName
        If name = AppDomain.CurrentDomain.SetupInformation.ApplicationName Then
            name = "defaultDomain"
        End If
        Console.WriteLine((greetings + " from " + name))
    End Sub

End Class
开发者ID:VB.NET开发者,项目名称:System,代码行数:29,代码来源:AppDomain.DoCallBack


注:本文中的System.AppDomain.DoCallBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。