C # Создание и использование функций

Мне нужна помощь с программированием на C #; Я новичок в этом, и я родом из Си фона. У меня есть консольное приложение, как это:

<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>

Это дает мне эту ошибку в строке, которую я вызываю Add ():

An object reference is required for the non-static field, method, or property 'Add_Function.Program.Add(int, int)'

Может кто-нибудь, пожалуйста, объясните мне, почему у меня есть эта проблема. Это потому, что архитектура C # отличается от C, и, как я это называю, неправильно? Благодарю.

Ответы на вопрос(11)

Ваш ответ на вопрос