C#查找对象在ArrayList中的位置的代码

238 阅读1分钟

下边代码是关于C#查找对象在ArrayList中的位置的代码,应该对码农有较大用途。 ArrayList alcollect = new ArrayList();

string str = "learn csharp"; alcollect.Add(str);

Console.WriteLine(alcollect.IndexOf(str));