using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
public class MyTest : IEnumerator
{
public object Current
{
get { return null; }
}
public bool MoveNext()
{
return false;
}
public void Reset()
{
}
}
//这个例子是显示arraylist的。arraylist和array 相当于 stringbuilder和string的关系。但是如果要把arraylist变化成数组
//需要你手工进行复制的操作.
class Program
{
static void Main(string[] args)
{
ArrayList myArrayList = new ArrayList(3);
string[] yourName = new string[2];
yourName[0] = "ok";
yourName[1] = "hello";
myArrayList.Add("20");
myArrayList.Add("40");
myArrayList.Add("50");
myArrayList.Add("70");
myArrayList.Insert(1, "10");
myArrayList.AddRange(yourName);
myArrayList.RemoveRange(0, (2<=myArrayList.Count?2:myArrayList.Count));
foreach (string item in myArrayList)
{
Console.WriteLine(item);
}
}
}
}
相关文章:
-
2021-04-07
-
2021-10-26
-
2022-12-23
-
2022-12-23
-
2021-09-19
-
2021-09-01
-
2021-06-30
猜你喜欢
-
2021-11-11
-
2021-07-10
-
2021-10-09
-
2021-06-25
-
2021-11-02
-
2021-11-25
-
2022-12-23
相关资源
-
下载
2021-06-06
-
下载
2021-06-06
-
下载
2021-06-05