本文實(shí)例講述了C#查找對(duì)象在ArrayList中出現(xiàn)位置的方法。分享給大家供大家參考。具體分析如下:
我們可以通過(guò)IndexOf方法來(lái)查找對(duì)象在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));
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選