public Replace ( object old, object value ) : bool | ||
old | object | |
value | object | |
Résultat | bool |
public void Replace3() { LinkedList list = new LinkedList(); list.Add( "0" ); list.Add( "1" ); Assert.IsFalse( list.Replace("11", "x") ); Assert.AreEqual( 2, list.Count ); String[] array = (String[]) list.ToArray( typeof(String) ); Assert.AreEqual( "0,1", String.Join(",", array) ); }
public void Replace4() { LinkedList list = new LinkedList(); list.Add( "0" ); list.Add( "1" ); list.Add( "2" ); list.Add( "3" ); Assert.IsTrue( list.Replace("2", "x") ); Assert.AreEqual( 4, list.Count ); String[] array = (String[]) list.ToArray( typeof(String) ); Assert.AreEqual( "0,1,x,3", String.Join(",", array) ); }
public void Replace3() { LinkedList list = new LinkedList(); list.Add( "0" ); list.Add( "1" ); Assert.IsFalse( list.Replace("11", "x"), "Successfully replaced 11 with x when it should have failed." ); Assert.AreEqual( 2, list.Count ); String[] array = (String[]) list.ToArray( typeof(String) ); Assert.AreEqual( "0,1", String.Join(",", array) ); }