' Collection of code snippets by Arne Vajhøj 
' (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
Imports System

Public Class Calc
Inherits MarshalByRefObject
    Private no As Integer
    Private Shared total As Integer = 0
    Private sync As Object = New Object 

    Public Sub New()
        SyncLock sync
            total = total + 1
            no = total
        End SyncLock
    End Sub

    Public Function add(ByVal a As Integer, ByVal b As Integer) As Integer
        Return (a + b)
    End Function

    Public Function mul(ByVal a As Integer, ByVal b As Integer) As Integer
        Return (a * b)
    End Function

    Public ReadOnly Property ID() As String
        Get
            Return (no & " of " & total)
        End Get
    End Property
End Class
