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


C# GenericList.FindElemByValue方法代码示例

本文整理汇总了C#中GenericList.FindElemByValue方法的典型用法代码示例。如果您正苦于以下问题:C# GenericList.FindElemByValue方法的具体用法?C# GenericList.FindElemByValue怎么用?C# GenericList.FindElemByValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GenericList的用法示例。


在下文中一共展示了GenericList.FindElemByValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main()
    {
        GenericList<int> listTesting = new GenericList<int>(1);
        listTesting.AddElement(2);
        listTesting.AddElement(3);
        listTesting.AddElement(4);
        listTesting.AddElement(5);
        listTesting.AddElement(6);
        listTesting.AddElement(-1000);

        Console.WriteLine(listTesting);

        listTesting.RemoveElemAtIndex(4);

        Console.WriteLine(listTesting);

        listTesting.InsertElemAtIndex(0, 123);

        Console.WriteLine(listTesting);

        Console.WriteLine(listTesting.FindElemByValue(123));

        Console.WriteLine(listTesting.Max());
        Console.WriteLine(listTesting.Min());

        listTesting.ClearList();

        Console.WriteLine(listTesting);
    }
开发者ID:HansS,项目名称:TelerikAcademy-homework,代码行数:29,代码来源:Program.cs

示例2: Main

        static void Main(string[] args)
        {
            GenericList<int> test = new GenericList<int>();
            Random randomNumber = new Random();
            for (int i = 0; i < 10; i++)
            {
                test.AddElement(randomNumber.Next(1, 100));
            }

            Console.WriteLine("The GenericList is:\n {0}",test);
            test.RemoveElementByIndex(0);
            Console.WriteLine("After removing element by index, the GenericList is:\n {0}",test);
            test.InsertElementByIndex(5, 89);
            Console.WriteLine("After insert new element, the GenericList is:\n {0}", test);
            test.FindElemByValue(89);
            Console.WriteLine("The maximal element is: {0}",test.Maximum());
            Console.WriteLine("The minimal element is: {0}", test.Minimum());
            test.CleanList();
            Console.WriteLine("After clearing the GenericList is: {0}",test);
        }
开发者ID:KaloyanBobev,项目名称:OOP,代码行数:20,代码来源:GenericListProgram.cs


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