CSharpTest.Net
SynchronizedList<T> Constructor(IList<T>,ILockStrategy)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > SynchronizedList<T> Class > SynchronizedList<T> Constructor : SynchronizedList<T> Constructor(IList<T>,ILockStrategy)

storage
locking

Glossary Item Box

Constructs a thread-safe generic collection of T, wrapped around the instance in storage

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal storage As IList(Of T), _
   ByVal locking As ILockStrategy _
)
C# 
public SynchronizedList<T>( 
   IList<T> storage,
   ILockStrategy locking
)

Parameters

storage
locking

Example

Library/Library.Test/TestSynchronizedCollections.cs

C#Copy Code
SynchronizedList<int> list = new SynchronizedList<int>(new List<int>(), new IgnoreLocking());
list.Insert(0, 1);
Assert.AreEqual(1, list.Count);
list.ReplaceStorage(new List<int>());
Assert.AreEqual(0, list.Count);
VB.NETCopy Code
Dim list As New SynchronizedList(Of Integer)(New List(Of Integer)(), New IgnoreLocking())
list.Insert(0, 1)
Assert.AreEqual(1, list.Count)
list.ReplaceStorage(New List(Of Integer)())
Assert.AreEqual(0, list.Count)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys