title: C# Creating and using Functions
body: <p>I need help with C# programming; I am new to it and I come from C background.  I have a Console Application like this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace Add_Function
  {
     class Program
     {
        static void Main(string[] args)
        {
           int a;
           int b;
           int c;
  
           Console.WriteLine("Enter value of 'a':");
           a = Convert.ToInt32(Console.ReadLine());
  
           Console.WriteLine("Enter value of 'b':");
           b = Convert.ToInt32(Console.ReadLine());
  
           //why can't I not use it this way?
           c = Add(a, b);
           Console.WriteLine("a + b = {0}", c);
        }//END   Main
  
        public int Add(int x, int y)
        { 
           int result = x + y;
           return result;
        }//END   Add
     }//END      Program
  }//END         Add_Function
  </code></pre>
  
  <p>It gives me this error on the line that I call Add():</p>
  
  <blockquote>
    <p>An object reference is required for the non-static field, method, or property 'Add_Function.Program.Add(int, int)'</p>
  </blockquote>
  
  <p>Can anyone please explain to me why I have this problem.  Is this because the architecture of C# is different than C, and the way I call it is wrong?  Thanks.</p>