C# Inspect recursive multiple TextBox

With this operation we will be able to go inside to see if one or more controls TextBox there are a certain value. We analyze the code C#.
  1. private bool CheckText(string[]values, params TextBox[]tetxboxes)  
  2. {  
  3.     var result = false;  
  4.   
  5.     for (var i = 0; i < tetxboxes.Count(); i++)  
  6.     {  
  7.         for (var j = 0; j < values.Count(); j++)  
  8.         {  
  9.             if (tetxboxes[i].Text.Contains(values[j]))  
  10.             {  
  11.                 result = true;  
  12.             }  
  13.         }  
  14.     }  
  15.   
  16.     return result;  
  17. }  
The function requires two arguments, the first a string array on which ensure during the validation phase, or at the time for example to run a tap on a button, you can exploit in different ways, or with static text as in this If, with the variables or even with other TextBox, interesting and instead the keyword params. 
"By using the params keyword, you can specify a method parameter. This link is external, it will open in a new window, and it uses a variable number of arguments.
You can send a list of arguments separated by commas of the type specified in the declaration of an array of arguments or parameters of the specified type can also not send any arguments. If arguments are not sent, the length of the list params is zero. 
In a method declaration you can't add additional parameters after the keyword params and is allowed to use only one params keyword. "
In this case you have the ability to perform the same control over multiple TextBox, as explained on Msdn the possibility of inserting more objects of the declared type of course for the TextBox control in this case.
To use the function proceed in this way.
  1. private void btn1_Tap(object sender, System.Windows.Input.GestureEventArgs e)  
  2. {  
  3.     if (CheckText(new []{"cat""dog"}, txt1, txt2).Equals(true))  
  4.     {  
  5.         // your code here  
  6.     }  
  7.   
  8.     else  
  9.     {  
  10.         MessageBox.Show("Nessun value present!");  
  11.     }  
  12. }