亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#判斷頁面中的多個文本框輸入值是否有重復的實現(xiàn)方法

 更新時間:2014年10月29日 11:20:37   投稿:shichen2014  
這篇文章主要介紹了C#判斷頁面中的多個文本框輸入值是否有重復的實現(xiàn)方法,是一個非常簡單實用的技巧,需要的朋友可以參考下

本文實例講述了C#判斷頁面中的多個文本框輸入值是否有重復的實現(xiàn)方法,分享給大家供大家參考。具體實現(xiàn)方法如下:

復制代碼 代碼如下:
List<string> list = new List<string>();//首先定義一個泛型數(shù)組

//這里假如說有四個文本框

string mainseat = this.textBox1.Text;
string nextseat = this.textBox2.Text;
string storeseat1 = this.textBox3.Text;
string storeseat2 = this.textBox4.Text;
if (mainseat != "")
{
     list.Add(mainseat);
}
if (nextseat != "")
{
      list.Add(nextseat);
}
if (storeseat1 != "")
{
      list.Add(storeseat1);
}
if (storeseat2 != "")
{
       list.Add(storeseat2);
}    
if (list.Distinct().Count<string>() != list.Count)//排查數(shù)組中是否有重復元素
{
       //此時說明有重復
}          
else

       //說明沒有重復

希望本文所述對大家的C#程序設計有所幫助。

相關文章

最新評論