国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

c# arraylist functions

2024-07-21 02:29:18
字體:
來源:轉載
供稿:網友

when you put then in the array list you could check to see if the item already exists.  this code snippet will check to see if the string is already in the array and will only add it when the item doesn't already exist in the list.

static void main( string[] args )
{
 arraylist list = new arraylist();

 addtolist( list, "table1" );
 addtolist( list, "table4" );
 addtolist( list, "table1" );
 addtolist( list, "table3" );
 addtolist( list, "table2" );
 addtolist( list, "table2" );

foreach ( string s in list ) //this will loop the collection to show there are no duplicates
 {
  console.writeline( s );
 }
}

private static void addtolist( arraylist list, string p )
{
 if ( list.contains( p ) == false )
  list.add( p );
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 云龙县| 务川| 陇南市| 苏尼特右旗| 上思县| 鄢陵县| 正定县| 江油市| 兴安盟| 乌什县| 黔江区| 怀柔区| 阳江市| 枝江市| 江门市| 蓬安县| 广州市| 平阴县| 望奎县| 栾城县| 溧水县| 田东县| 定襄县| 洛扎县| 遂昌县| 鹤山市| 县级市| 吉木萨尔县| 修武县| 独山县| 子洲县| 元江| 邢台市| 西乡县| 项城市| 淮南市| 奉节县| 靖江市| 荣昌县| 潜江市| 油尖旺区|