Perhaps the C# forum would be a more appropriate place for this thread. I suggest that you PM a mod and ask them to move it.

The reason for your error is that you must declare a type before you can declare a member. You've declared a method, which cannot exist on its own. It must be within a type declaration. That's why you're told that it is expecting one of those list of things, all of which are types.