本文整理汇总了C#中LinkedStack.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# LinkedStack.ToArray方法的具体用法?C# LinkedStack.ToArray怎么用?C# LinkedStack.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkedStack
的用法示例。
在下文中一共展示了LinkedStack.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
var linkedStack = new LinkedStack<int>();
linkedStack.Push(7);
linkedStack.Push(8);
linkedStack.Push(9);
Console.WriteLine(string.Join(" ", linkedStack.ToArray()));
Console.WriteLine("Popped element: " + linkedStack.Pop().ToString());
Console.WriteLine(string.Join(" ", linkedStack.ToArray()));
}
示例2: ToArrayOnEmptyStackShouldReturnEmptyArray
public void ToArrayOnEmptyStackShouldReturnEmptyArray()
{
LinkedStack<int> stack = new LinkedStack<int>();
var resultArray = stack.ToArray();
Assert.AreEqual(0, resultArray.Length);
}
示例3: EmptyArraysShouldBeEqual
public void EmptyArraysShouldBeEqual()
{
var stack = new LinkedStack<DateTime>();
var array = new DateTime[] { };
CollectionAssert.AreEqual(array, stack.ToArray());
}
示例4: TestEmptyStackToArray
public void TestEmptyStackToArray()
{
var stack = new LinkedStack<DateTime>();
DateTime[] array = stack.ToArray();
Assert.AreEqual(0, array.Length);
}
示例5: To_Array_Empty
public void To_Array_Empty()
{
var dates = new LinkedStack<DateTime>();
var arrTest = new DateTime[0];
CollectionAssert.AreEqual(arrTest, dates.ToArray());
}
示例6: EmptyLinkedStackToArray
public void EmptyLinkedStackToArray()
{
var linkedStack = new LinkedStack<DateTime>();
var testArr = new DateTime[0];
CollectionAssert.AreEqual(testArr, linkedStack.ToArray());
}
示例7: Main
static void Main()
{
var collection = new LinkedStack<int>();
collection.Push(1);
collection.Push(2);
collection.Push(3);
collection.Push(4);
collection.Push(5);
collection.Push(6);
collection.Push(7);
collection.Push(8);
collection.Push(9);
Console.WriteLine(collection.Pop());
Console.WriteLine(collection.Pop());
Console.WriteLine(collection.Pop());
Console.WriteLine(collection.Pop());
Console.WriteLine(collection.Pop());
Console.WriteLine("Count: " + collection.Count);
var array = collection.ToArray();
Console.WriteLine(string.Join(", ", array));
Console.WriteLine(collection.Pop());
Console.WriteLine("Count: " + collection.Count);
}
示例8: TestEmptyStackToArray_ShouldReturnEmptyArray
public void TestEmptyStackToArray_ShouldReturnEmptyArray()
{
var stack = new LinkedStack<DateTime>();
var array = stack.ToArray();
var expected = new DateTime[0];
CollectionAssert.AreEqual(expected, array);
}
示例9: Main
static void Main()
{
LinkedStack<int> numbers = new LinkedStack<int>();
numbers.Push(2);
numbers.Push(3);
numbers.Push(-4);
numbers.ToArray();
}
示例10: EmptyStackToArray_ArrayShouldBeEmpty
public void EmptyStackToArray_ArrayShouldBeEmpty()
{
var stack = new LinkedStack<int>();
var array = stack.ToArray();
Assert.AreEqual(0, array.Length);
}
示例11: LinkedStackOfDatesToArrayShouldReturnEmptyArray
public void LinkedStackOfDatesToArrayShouldReturnEmptyArray()
{
LinkedStack<DateTime> linkedStackDateTime = new LinkedStack<DateTime>();
int[] expected = { };
DateTime[] result = linkedStackDateTime.ToArray();
CollectionAssert.AreEqual(expected, result);
}
示例12: TestEmptyStackToArray_ShouldReturnEmptyArray
public void TestEmptyStackToArray_ShouldReturnEmptyArray()
{
var stack = new LinkedStack<List<Dictionary<bool[], decimal>>>();
var arr = stack.ToArray();
Assert.AreEqual(0, arr.Length);
}
示例13: ToArray_EmptyStack_ShouldReturnEmptyArray
public void ToArray_EmptyStack_ShouldReturnEmptyArray()
{
var stack = new LinkedStack<DateTime>();
var arr = stack.ToArray();
CollectionAssert.AreEqual(new DateTime [] {}, arr);
}
示例14: To_Array
public void To_Array()
{
var nums = new LinkedStack<int>();
nums.Push(3);
nums.Push(5);
nums.Push(-2);
nums.Push(7);
int[] arrTest = { 7, -2, 5, 3 };
CollectionAssert.AreEqual(arrTest, nums.ToArray());
}
示例15: array
public void array()
{
LinkedStack<int> testArray = new LinkedStack<int>();
testArray.Push(3);
testArray.Push(5);
testArray.Push(-2);
testArray.Push(7);
CollectionAssert.AreEqual(new int[] { 7, -2, 5, 3 }, testArray.ToArray());
}