title: Using Generics with DisplayArray method in WindowsForm
body: <p>I created a button in Windows Forms labeled Generics. When the button is clicked I want the array to display. I was able to execute in a standard .net application, but when trying to produce in windows forms only the message is displaying. How can I get the message to display and show the array?</p>
  
  <pre><code> private void btnGeneric_Click(object sender, EventArgs e)
          {
              int[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
              char[] charArray = { 'C', 'h', 'a', 'r', ' ', 'A', 'r', 'r', 'a', 'y' };
              String D1;
  
              MessageBox.Show("Array intArray Contains: ");
              DisplayArray(intArray);
              MessageBox.Show("Array charArray Contains: ");
              DisplayArray(charArray);
  
  
          }
          private static void DisplayArray&lt;T&gt;(T[] inputArray)
          {
              foreach (T element in inputArray)
                  Console.Write(element + "");
              Console.WriteLine("\n");
          }
  </code></pre>