Why can't I implement the static function (static void fction(Stuff S)) inside of Main
If I cut and paste the function outside of main, the program compiles and works fine.
When the program runs I get the output: "Monkey1: chocolate"
using System;
using System.Collections.Generic;
namespace Empty
{
public class Stuff
{
public string monkey
{
get;
set;
}
}
public class Empty
{
static void Main(string[] args)
{
Stuff S1 = new Stuff();
S1.monkey = "Banana";
Stuff.fction(S1);
static void fction(Stuff S) // THIS GIVES ME AN ERROR
{ //IF I PUT THIS FUNCTION OUTSIDE OF MAIN THE
// PROGRAM WORKS
S.monkey ="CHocolate "; // WHAT IS GOING ON?
}
Console.WriteLine("Monkey 1: " + S1.monkey);
}
}//End of Empty class
}