本文實例講述了C#查找對象在ArrayList中出現位置的方法。分享給大家供大家參考。具體分析如下:
我們可以通過IndexOf方法來查找對象在ArrayList中的位置
ArrayList alcollect = new ArrayList();// Add individual items to the collectionstring str = "learn csharp";alcollect.Add(str);//find position of objectConsole.WriteLine(alcollect.IndexOf(str));
希望本文所述對大家的C#程序設計有所幫助。
新聞熱點
疑難解答