nutshell program driving me nuts.

Hello: I am getting started. The first program I tried from the Nutshell book, A first C# program on page nine does not work. I get a "null reference exception". The program is OK, because I can compile and run it from the command prompt and besides, it is your program. Right now, this makes cmd easier to use than Linqpad. I have the Linqpad set to C# program. Oddly enough, I found if I comment the outer braces for the class; then it runs OK. Does this mean that Linqpad does not run regular programs? In other words, I can't just paste in programs?
By the way, I need two more characters to get my name to fit, can you increase the character count from twenty to twenty-two?

//using System; // Importing namespace
//class Test // Class declaration
{ // **** comment here
static void Main() // Method declaration
int x = 12 * 300; // Statement 1
System.Console.WriteLine (x); // Statement 2
} // End of method
} // End of class, ***** comment this line, and the matching one above, and it works.


Sign In or Register to comment.