Public Class PzscSingleHandler
Private Sub New()
End Sub
Private Shared instanceList
As New System.Collections.Generic.Dictionary(
Of Guid, PzscSingleHandler)
Private Shared obj
As New Object()
''' <summary>
''' 根据项目GUID获取实例
''' </summary>
''' <param name="projGUID"></param>
''' <returns></returns>
Public Shared Function GetInstance(
ByVal projGUID
As Guid)
As PzscSingleHandler
If projGUID = Guid.Empty
Then
Return Nothing
End If
SyncLock (obj)
If Not instanceList.ContainsKey(projGUID)
Then
instanceList.Add(projGUID, New PzscSingleHandler())
End If
Return instanceList(projGUID)
End SyncLock
End Function
Public Function test()
As String
Return ""
End Function
End Class
转载于:https://www.cnblogs.com/zhouyu/p/11281355.html