1:请编程遍历WinForm页面上所有TextBox控件并给它赋值为string.Empty
foreach (System.Windows.Forms.Control control in this.Controls)
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ;
tb.Text = String.Empty ; }
}
2:有一个8个数的数组{1,2,3,3,4,5,6,6},计算其中不重复数字的个数。
int values = {1,2,3,3,4,5,6,6};
HashSet<int> set = new HashSet<int>();
foreach(int i in values)
{set.Add(i);}
Console.WriteLine(set.Count)