当前位置: 首页>>代码示例>>C#>>正文


C# LinkedStack.ToArray方法代码示例

本文整理汇总了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()));
 }
开发者ID:anichalakova,项目名称:DataStructuresHWs,代码行数:10,代码来源:Program.cs

示例2: ToArrayOnEmptyStackShouldReturnEmptyArray

        public void ToArrayOnEmptyStackShouldReturnEmptyArray()
        {
            LinkedStack<int> stack = new LinkedStack<int>();
            var resultArray = stack.ToArray();

            Assert.AreEqual(0, resultArray.Length);
        }
开发者ID:tockata,项目名称:Data-Structures,代码行数:7,代码来源:LinkedStackTests.cs

示例3: EmptyArraysShouldBeEqual

        public void EmptyArraysShouldBeEqual()
        {
            var stack = new LinkedStack<DateTime>();
            var array = new DateTime[] { };

            CollectionAssert.AreEqual(array, stack.ToArray());
        }
开发者ID:plamenyovchev,项目名称:DataStructures,代码行数:7,代码来源:LinkedStackTests.cs

示例4: TestEmptyStackToArray

        public void TestEmptyStackToArray()
        {
            var stack = new LinkedStack<DateTime>();
            DateTime[] array = stack.ToArray();

            Assert.AreEqual(0, array.Length);
        }
开发者ID:bobosam,项目名称:DataStructures,代码行数:7,代码来源:LinkedStackTests.cs

示例5: To_Array_Empty

        public void To_Array_Empty()
        {
            var dates = new LinkedStack<DateTime>();
            var arrTest = new DateTime[0];

            CollectionAssert.AreEqual(arrTest, dates.ToArray());
        }
开发者ID:Petar-Ivanov256,项目名称:DataStuctures_HomeWorks,代码行数:7,代码来源:LinkedStackTests.cs

示例6: EmptyLinkedStackToArray

        public void EmptyLinkedStackToArray()
        {
            var linkedStack = new LinkedStack<DateTime>();
            var testArr = new DateTime[0];

            CollectionAssert.AreEqual(testArr, linkedStack.ToArray());
        }
开发者ID:Aleksandyr,项目名称:Software-University,代码行数:7,代码来源:LinkedStackTests.cs

示例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);
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:26,代码来源:Program.cs

示例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);
 }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:7,代码来源:UnitTest1.cs

示例9: Main

 static void Main()
 {
     LinkedStack<int> numbers = new LinkedStack<int>();
     numbers.Push(2);
     numbers.Push(3);
     numbers.Push(-4);
     numbers.ToArray();
 }
开发者ID:simooo93,项目名称:SoftUni-Homeworks,代码行数:8,代码来源:LinkedStackTest.cs

示例10: EmptyStackToArray_ArrayShouldBeEmpty

        public void EmptyStackToArray_ArrayShouldBeEmpty()
        {
            var stack = new LinkedStack<int>();

            var array = stack.ToArray();

            Assert.AreEqual(0, array.Length);
        }
开发者ID:stoian2662,项目名称:Data-Structures-And-Algorithms,代码行数:8,代码来源:UnitTestsLinkedStack.cs

示例11: LinkedStackOfDatesToArrayShouldReturnEmptyArray

        public void LinkedStackOfDatesToArrayShouldReturnEmptyArray()
        {
            LinkedStack<DateTime> linkedStackDateTime = new LinkedStack<DateTime>();
            int[] expected = { };
            DateTime[] result = linkedStackDateTime.ToArray();

            CollectionAssert.AreEqual(expected, result);
        }
开发者ID:iliankostov,项目名称:DataStructures,代码行数:8,代码来源:LinkedStackUnitTests.cs

示例12: TestEmptyStackToArray_ShouldReturnEmptyArray

            public void TestEmptyStackToArray_ShouldReturnEmptyArray()
            {
                var stack = new LinkedStack<List<Dictionary<bool[], decimal>>>();

                var arr = stack.ToArray();

                Assert.AreEqual(0, arr.Length);
            }
开发者ID:IvanMladenov,项目名称:DataStructuresCourse,代码行数:8,代码来源:UnitTest1.cs

示例13: ToArray_EmptyStack_ShouldReturnEmptyArray

        public void ToArray_EmptyStack_ShouldReturnEmptyArray()
        {
            var stack = new LinkedStack<DateTime>();

            var arr = stack.ToArray();

            CollectionAssert.AreEqual(new DateTime [] {}, arr);
        }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:8,代码来源:ToArrayTest.cs

示例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());
 }
开发者ID:Petar-Ivanov256,项目名称:DataStuctures_HomeWorks,代码行数:10,代码来源:LinkedStackTests.cs

示例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());
        }
开发者ID:kosio197,项目名称:SoftUni_DataStructures,代码行数:10,代码来源:TestLincedStack.cs


注:本文中的LinkedStack.ToArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。