ArrayList 注意点_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > ArrayList 注意点

ArrayList 注意点

 2017/10/14 11:25:47  靖康耻  程序员俱乐部  我要评论(0)
  • 摘要:1.usingSystem;usingSystem.Collections;usingSystem.Collections.Generic;classProgram{staticvoidMain(string[]args){varal=newArrayList{2,3,true,"aa",true};//al.Clear();varcount=al.Count;for(inti=0;i<count;i++){al.RemoveAt(0);}Console.WriteLine(al
  • 标签:list

1.

using System;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var al = new ArrayList { 2, 3, true, "aa", true };
        //al.Clear();
        var count = al.Count;
        for (int i = 0; i < count; i++)
        {
            al.RemoveAt(0);
        }
        Console.WriteLine(al.Count);
    }
}

 

using System;
using System.Collections;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var al = new ArrayList {"aa", "ab"};
        al.Remove(new string(new char[] {'a', 'b'}));
        foreach (var o in al)
        {
            Console.WriteLine(o);
        }
    }
}

 

发表评论
用户名: 匿名