Calling Method of class within it

// What is the technical reason behind this scenarios..?

Jon Skeet
people
quotationmark

You're trying to use a statement other than a declaration directly inside the class - rather than within a method. When did you expect the method to get called?

Basically all you can have directly within a type is a bunch of declarations - methods, variables, constructors, events, nested types etc. Method calls (or any other statements) which aren't part of a declaration have to be written within methods, constructors etc.

people

See more on this question at Stackoverflow