本文整理汇总了C#中DoublyLinkedList.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# DoublyLinkedList.CopyTo方法的具体用法?C# DoublyLinkedList.CopyTo怎么用?C# DoublyLinkedList.CopyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoublyLinkedList
的用法示例。
在下文中一共展示了DoublyLinkedList.CopyTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyTo
public void CopyTo()
{
var list = new DoublyLinkedList<int>(new[] { 1, 2, 3 });
var array = new int[4];
list.CopyTo(array, 1);
CollectionAssert.AreEqual(new[] {0, 1, 2, 3}, array);
}
示例2: CopyToWithLessSpaceInTheArray
public void CopyToWithLessSpaceInTheArray()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
int[] array = new int[3];
list.Add(3);
list.Add(5);
list.Add(7);
list.CopyTo(array, 2);
}
示例3: CopyTo
public void CopyTo()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
int[] array = new int[3];
list.Add(3);
list.Add(5);
list.Add(7);
list.CopyTo(array, 0);
}
示例4: AddAtHead
public void AddAtHead()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
int[] array = new int[3];
list.Add(3);
list.ShouldContain(3);
list.Add(5);
list.ShouldContain(5);
list.Add(7);
list.ShouldContain(7);
list.CopyTo(array, 0);
}
示例5: TestDoublyLinkedListIndexer
public void TestDoublyLinkedListIndexer()
{
DoublyLinkedList<string> list = new DoublyLinkedList<string>();
list.Add("One");
list.Add("Two");
list.Add("Three");
list[0] = "Zero";
string[] array = new string[list.Count];
list.CopyTo(array);
Assert.AreEqual("Zero, Two, Three", string.Join(", ", array));
}
示例6: CopyToWithNegativeIndex
public void CopyToWithNegativeIndex()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
int[] array = new int[3];
list.Add(3);
list.Add(5);
list.Add(7);
list.CopyTo(array, -2);
}
示例7: RemoveForAListWithTwoItems
public void RemoveForAListWithTwoItems()
{
DoublyLinkedList<int> list = new DoublyLinkedList<int>();
int[] array = new int[5];
list.Add(7);
list.Add(6);
list.Add(5);
list.Add(4);
list.Add(3);
list.CopyTo(array, 0);
list.Remove(5);
list.CopyTo(array, 0);
list.ShouldNotContain(5);
list.ShouldContain(3);
}
示例8: TestDoublyLinkedListInsert_InsertAtTheEnd
public void TestDoublyLinkedListInsert_InsertAtTheEnd()
{
DoublyLinkedList<string> list = new DoublyLinkedList<string>();
list.Add("One");
list.Add("Two");
list.Add("Three");
list[0] = "Zero";
list.Insert(3, "Ten");
string[] array = new string[list.Count];
list.CopyTo(array);
Assert.AreEqual("Zero, Two, Three, Ten", string.Join(", ", array));
}