You are defining a method inside another method, and that is not allowed in C#.
Change it to this:
namespace csfunction
{
class Program
{
static void Main(string[] args)
{
}
public static int AddNumbers(int number1, int number2)
{
int result = AddNumbers(10, 5);
Console.WriteLine(result);
}
}
}
Then if you want to call AddNumbers from Main, add the following line inside Main
AddNumbers( 10, 5);
Also note that you are not using the parameters inside AddNumbers for anything. The method should probably look like this:
public int AddNumbers(int number1, int number2)
{
int result = number1 + number2;
Console.WriteLine(result);
}
In it's current form it's calling itself recursively also, and will go into an endless loop.
So basically, there are tons of problems with your code. You should probably try to get an entry level book on C# to brush up on your C# skills.