本文整理汇总了C#中GenericList.ReadElement方法的典型用法代码示例。如果您正苦于以下问题:C# GenericList.ReadElement方法的具体用法?C# GenericList.ReadElement怎么用?C# GenericList.ReadElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericList
的用法示例。
在下文中一共展示了GenericList.ReadElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
GenericList<int> testList = new GenericList<int>(5);
testList.AddElement(55);
testList.AddElement(550);
testList.AddElement(-55);
testList.AddElement(564565);
testList.AddElement(-568);
testList.AddElement(5500);
testList.AddElement(5858645);
testList.AddElement(4444);
Console.WriteLine(testList.SearchByValue(-568));
Console.WriteLine(testList.ReadElement(1));
testList.RemoveElement(1);
testList.InsertAtPosition(2, -696969);
Console.WriteLine(testList.Max());
Console.WriteLine(testList.Min());
}
示例2: Main
static void Main()
{
// Define list
GenericList<int> testList = new GenericList<int>(1);
//Test method AddElement and auto grow functionality
testList.AddElement(1);
testList.AddElement(2);
testList.AddElement(3);
testList.AddElement(4);
Console.WriteLine(testList);
// Test method ReadElement
Console.WriteLine("Element at position 2 is: {0}", testList.ReadElement(2));
//Test method RemoveElement
testList.RemoveElement(1);
Console.WriteLine("After removing an element: {0}", testList);
//Test method InsertElement
testList.InsertElement(2, 111);
Console.WriteLine("After inserting an element: {0}", testList);
//Test method FindElemenetByValue
Console.WriteLine("The element is at position: {0}", testList.FindElemenetByValue(111));
// Test method Min<T>
Console.WriteLine("Element with minimum value is: {0}",testList.Min());
// Test method Max<T>
Console.WriteLine("Element with maximum value is: {0}", testList.Max());
//Test method ClearList
testList.ClearList();
Console.WriteLine("After clearing the list: {0}", testList);
}