// Synchronize on an object's monitor, in this case
// the current object
public class Synchronization
{
    private System.Collections.Generic.List<string> _items;
    public void AddItemsSafe(string[] items)
    {
        lock (this)
        {
            foreach (var item in items)
            {
                _items.Add(item);
            }
        }
    }
// No equivalent of synchronized methods in C#
}
 
				   | 
 
				   
					 *> Synchronize on an object's monitor,
*> in this case the current object
class-id synchronization public.
01 _items list[string].
method-id addItemsSafe (items as string occurs any).
    sync on self
        perform varying auto item thru items
            write _items from item
        end perform
    end-sync
end method.
method-id addItemSafe (item as string) sync.
    write _items from item
end method.
end class.
 
				   | 
				  
					 ' Synchronize on an object's monitor
' in this case the current object
Public Class Synchronization
    private _items As System.Collections.Generic.List(Of string)
    Public Sub AddItemsSafe(items As String())
        SyncLock Me
            For Each item In items
                _items.Add(item)
            Next
        End SyncLock
    End Sub
    ' No equivalent of synchronized methods in VB.NET
End Class
				   |