欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

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

復(fù)制代碼 代碼如下:
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ù)組中是否有重復(fù)元素
{
       //此時說明有重復(fù)
}          
else

       //說明沒有重復(fù)

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

相關(guān)文章

最新評論