CSharpTest.Net
ReplaceAll Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > SetList<T> Class : ReplaceAll Method

items

Glossary Item Box

Adds or replaces an item in the collection, returns true if any item was replaced

Syntax

Visual Basic (Declaration) 
Public Function ReplaceAll( _
   ByVal items As IEnumerable(Of T) _
) As Boolean
C# 
public bool ReplaceAll( 
   IEnumerable<T> items
)

Parameters

items

Example

Library/Library.Test/TestSetList.cs

C#Copy Code
MyValue one = new MyValue(1);
MyValue two = new MyValue(2);
SetList<MyValue> set = new SetList<MyValue>();
set.Add(one);
set.Add(two);

Assert.AreEqual(2, set.Count);
Assert.IsTrue(Object.ReferenceEquals(one, set[0]));
Assert.IsTrue(set.ReplaceAll(new MyValue[] { new MyValue(1), new MyValue(3) }));
Assert.IsFalse(Object.ReferenceEquals(one, set[0]));
Assert.AreEqual(3, set.Count);
VB.NETCopy Code
Dim one As New MyValue(1)
Dim two As New MyValue(2)
Dim [set] As New SetList(Of MyValue)()
[set].Add(one)
[set].Add(two)

Assert.AreEqual(2, [set].Count)
Assert.IsTrue([Object].ReferenceEquals(one, [set](0)))
Assert.IsTrue([set].ReplaceAll(New MyValue() {New MyValue(1), New MyValue(3)}))
Assert.IsFalse([Object].ReferenceEquals(one, [set](0)))
Assert.AreEqual(3, [set].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