The following is the "Hello World" program that I tried to get it compiled with, the Microsoft .Net compiler, by the command "cs".
Using System
public class csharp1
{
private static void main()
{
console.writeline("yaaannn");
}
}
But I got the error:
CS0116: A namespace does not directly contain members such as fields or methods
that too at (1,1)
I checked out for this error:
Error "A namespace does not directly contain members such as fields or methods"
In the above question the compilation was being done through "Visual studio ". So , I am not sure if the things about "app.config" file hold good here when the compilation is being done through inbuilt compiler and from command prompt.
Then I checked the following question:
"A namespace cannot directly contain members such as fields or methods" in Net.Reflector
But here as we can see there was a variable which was not enclosed inside the braces of a class, however in this code there was no variable which was out of the confinements of a class.
So, I am unable to know what is causing this problem.
I thought I am missing a semicolon after "Using system " but that too threw the same error.