本文整理汇总了C#中GenericList.RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C# GenericList.RemoveAll方法的具体用法?C# GenericList.RemoveAll怎么用?C# GenericList.RemoveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericList
的用法示例。
在下文中一共展示了GenericList.RemoveAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
var list = new GenericList<int>();
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
list.Add(3);
Console.WriteLine(list);
list[4] = 5;
Console.WriteLine(list);
list.Add(-5);
Console.WriteLine(list);
Console.WriteLine("list[2] = " + list[2]);
Console.WriteLine();
list.RemoveByIndex(list.Count - 1);
Console.WriteLine(list);
Console.WriteLine();
list.Insert(list.Count, 0);
Console.WriteLine(list);
Console.WriteLine();
Console.WriteLine(list.GetIndexByValue(5));
Console.WriteLine(list.IsContain(5));
Console.WriteLine("Max = " + list.Max());
Console.WriteLine("Min = " + list.Min());
Console.WriteLine();
list.RemoveAll();
Console.WriteLine("Empty list" + list);
Type type = typeof(GenericList<>);
object[] allAttributes = type.GetCustomAttributes(typeof(VersionAttribute), false);
Console.WriteLine("GenericsList's version is {0}", ((VersionAttribute)allAttributes[0]).Version);
}
示例2: Main
static void Main(string[] args)
{
var list = new GenericList<int>();
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
list.Add(5);
list[4] = 19;
Console.WriteLine(list);
list.Add(-5);
Console.WriteLine(list);
Console.WriteLine("list[4] = " + list[4]);
list.RemoveByIndex(list.Count - 1);
Console.WriteLine(list);
Console.WriteLine("{0}",new string('-',60));
list.Insert(list.Count, 5);
Console.WriteLine(list);
Console.WriteLine("{0}", new string('-', 60));
Console.WriteLine(list.GetIndexByValue(5));
Console.WriteLine(list.IsContain(8));
Console.WriteLine("{0}", new string('-', 60));
Console.WriteLine("Highest = " + list.Max());
Console.WriteLine("Lowest = " + list.Min());
Console.WriteLine("{0}", new string('-', 60));
list.RemoveAll();
Console.WriteLine("After the List was Deleted = " + list);
Console.WriteLine("{0}", new string('-', 60));
Type type = typeof(GenericList<>);
object[] allAttributes = type.GetCustomAttributes(typeof(VersionAttribute), true);
}