热门:网页模板.net视频教程JQueryMVCjsonExtJs源码示例三级联动JQuery菜单
您现在的位置:.Net中文社区>> .Net编程>>正文内容

字符串数组去掉重复值方法

发布时间:2010年02月27日点击数: 佚名
  1. using System; 
  2. using System.Collections; 
  3. using System.Collections.Specialized; 
  4. namespace test 
  5.     class myTest 
  6.     { 
  7.         static void Main() 
  8.         { 
  9.  
  10.             string[] arrInt = new string[] { "1""1""2""3""4""33""4""66""77""2""44""33" }; 
  11.             ArrayList arr = new ArrayList(); 
  12.             foreach (string i in arrInt) 
  13.             { 
  14.                 if (arr.IndexOf(i) < 0) 
  15.                 { 
  16.                     arr.Add(i); 
  17.                      
  18.                 } 
  19.             } 
  20.  
  21.             //输出测试    
  22.             arrInt = (string[])arr.ToArray(typeof(string)); 
  23.             foreach (string n in arrInt) 
  24.             { 
  25.                 Console.WriteLine(n); 
  26.             }    
  27.         } 
  28.     } 

本站热点业务

更多模板/案例展示

关于我们 | 联系我们 | 团队日志 | 网站地图 | 网站合作