考慮我有一個共同的功能: -VB .NET共享功能如果被多次同時
Public Shared Function CalculateAreaFromRadius(ByVal radius As Double) As Double
' square the radius...
Dim radiusSquared As Double
radiusSquared = radius * radius
' multiply it by pi...
Dim result As Double
result = radiusSquared * Math.PI
'Wait a bit, for the sake of testing and
'simulate another call will be made b4 earlier one ended or such
for i as Integer = 0 to integer.Max
Next
' return the result...
Return result
End Function
我的問題:
如果我在同一個VB兩個或多個線程。網絡應用程序,每個人都用不同的RADIUS同時調用共享功能,他們每個人都會得到自己的區域?
我想知道每個函數的調用,如果它使用相同的本地變量或每個調用創建局部變量的新實例?
上述問題的答案是否相同如果我有多個(2+)單線程應用程序,並且它們都使用不同的RADIUS值同時調用該函數?
我會感謝您的迴應。謝謝。
感謝您的詳細描述 – 2010-03-31 19:55:24