国产探花免费观看_亚洲丰满少妇自慰呻吟_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 );
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张家口市| 深圳市| 攀枝花市| 洪雅县| 青神县| 扶风县| 神农架林区| 永年县| 香格里拉县| 洛浦县| 池州市| 进贤县| 东台市| 安达市| 微博| 玛曲县| 修文县| 平陆县| 安龙县| 长海县| 合山市| 体育| 本溪市| 铜山县| 日照市| 中山市| 宜黄县| 汉源县| 深圳市| 和龙市| 安平县| 时尚| 昭觉县| 民权县| 洪泽县| 淄博市| 伽师县| 尚志市| 长治县| 阜平县| 布尔津县|