本文整理汇总了C#中GenericList.FindAt方法的典型用法代码示例。如果您正苦于以下问题:C# GenericList.FindAt方法的具体用法?C# GenericList.FindAt怎么用?C# GenericList.FindAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericList
的用法示例。
在下文中一共展示了GenericList.FindAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
GenericList<int> list = new GenericList<int>();
list.Add(5);
list.Add(6);
list.Add(7);
list.Add(8);
Console.WriteLine(list.Min());
list.InsertAt(234, 2);
list.Print();
Console.WriteLine();
// Remove at index
list.RemoveAt(2);
list.Print();
Console.WriteLine();
// insert At
list.InsertAt(234, 2);
list.Print();
// find At
Console.WriteLine();
Console.WriteLine(list.FindAt(0));
// Test Find Method - using delagates ...
Console.WriteLine(list.Find(delegate(int value)
{
return value == 72;
}));
list.Clear();
list.Print();
// using attribute
Type type = typeof(TestGenericList);
object[] allAttributes = type.GetCustomAttributes(false);
foreach (VersionAttribute attr in allAttributes)
{
Console.WriteLine("Version of class TestGenericList is {0:0.00}",attr.Version);
}
}
示例2: Main
static void Main()
{
GenericList<int> list = new GenericList<int>(4);
Console.WriteLine("Added elements:");
list.Add(38);
list.Add(22);
list.Add(12);
list.Add(53);
list.Add(55);
Console.WriteLine(list);
Console.WriteLine("Element at possition 1: " + list.FindAt(1));
list.Remove(2);
Console.WriteLine("\nElements after removing element at possition 2:");
Console.WriteLine(list);
list.Insert(2, 11);
Console.WriteLine("Elements after inserting element at possition 2:");
Console.WriteLine(list);
int elementIndex = list.IndexOf(11);
Console.WriteLine("Index of element with value \"11\": " + elementIndex); ;
bool contains = list.Contains(55);
Console.WriteLine("\nIf element contains value \"55\"? " + contains);
Console.WriteLine("\nMin element: " + list.Min());
Console.WriteLine("\nMax element: " + list.Max());
var allAttributes = typeof(GenericList<>).GetCustomAttributes(typeof(Version), false);
Console.WriteLine("\nVersion: " + allAttributes[0]);
list.Clear();
Console.WriteLine(list);
}
示例3: Main
static void Main()
{
try
{
GenericList<int> itemsList = new GenericList<int>();
itemsList.Add(5);
itemsList.Add(11);
itemsList.Add(2);
itemsList.Add(-4);
itemsList.InsertAt(1, 9);
Console.WriteLine(itemsList.FindAt(1));
Console.WriteLine(itemsList.FindElement(15));
Console.WriteLine(itemsList.Min());
Console.WriteLine(itemsList.Max());
itemsList.ToString();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}