title: 'cannot convert from 'void' to 'object'
body: <p>Using in and out parameters, I get the error "Argument 2: cannot convert from 'void' to object". Not sure why it's doing this or how to fix it. Does anyone know a solution?    </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace ParameterPassing
  {
      class Program
      {
          static void Main(string[] args)
          {
              int a = 5;
              int b, c;
              int[] list = new int[5];
              ParameterTest p = new ParameterTest(3);
  
              Console.WriteLine("Without method: {0}", a);
  
              Console.WriteLine("After the method: {0}", p.Value(a));
  
              Console.WriteLine("Using the Swap method: {0}", p.Swap(ref a));
  
              Console.WriteLine("Here is an array: {0}", p.OddEven(out b, out c));
  
          }
      }
  }  
  </code></pre>
  
  <p>Methods:</p>
  
  <pre><code>namespace ParameterPassing
  {
      class ParameterTest
      {
          private int integer = 3;
  
  
          public ParameterTest(int myInt)
          {
              integer = myInt;
          }
  
          public int Value(int a)
          {
              a = 0;
              return a;
          }
  
          public int Swap(ref int b)
          {
              b = b * 4;
              return b;
          }
  
          public void OddEven(out int odd, out int even)
          {
              even = 0;
              odd = 0;
              int[] array = new int[5];
              Random generator = new Random(100);
              for (int i = 0; i &lt; array.Length; i++)
              {
                  array[i] = generator.Next(100);
              }
  
              foreach (int item in array)
              {
                  if (item % 2 == 0)
                  {
                      even = even++;
                  }
                  else
                  {
                      odd = odd++;
                  }
  
                  Console.WriteLine(item);
              }
  
              Console.WriteLine("The number of odd numbers in the array is: {0}", odd);
              Console.WriteLine("The number of even numbers in the array is: {1}", even);
          }
      }
  }
  </code></pre>
  
  <p>The error comes from the line the fourth <code>Console.WriteLine</code> at the top of the program, specifically in the part that is intended to output <code>p.OddEven</code>.</p>