本文整理汇总了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);
}
示例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);
}