C# 移除string[] 数组中的指定元素


 
第一步:先把string[] 转换成 ArrayList  
第二步:移除指定元素
第三步:在转换回string[]


using   System;
using   System.Collections;

class   Test
{
    static   void   Main()
    {
        string   []   arr   =   {   "abc1 ",   "abc2 ",   "abc3 ",   };
        ArrayList   al     =   new   ArrayList(arr);
        al.RemoveAt(1);
        arr   =   (string   [])al.ToArray(typeof(string));
        foreach   (string   s   in   arr)
        {
            Console.WriteLine(s);
        }
    }
}

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM