Link to home
Start Free TrialLog in
Avatar of Dodger42
Dodger42

asked on

Complete Noob question

Hey all, I'm completely newb to c#. I just started up a very basic application in VS2005, and cannot figure out why the following code does not actually writeline. I build and then try to run using Ctrl-F5.

using System;
public class HelloWorld
{
    public static void Main()
    {
        Console.WriteLine("Hello World! From Softsteel Solutions");
    }

}

Thanks
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hello Dodger42,

you seem to miss namespace and every project needs one, within the namespace you can add you classes etc....

if you start a new project from the start menu and choose for a console application you'll end up with a Progam.csclass file that contains a carcass like
--------------------------
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    public class HelloWorld
    {
        public static void Main()
        {
            Console.WriteLine("Hi there");  
        }
    }
}
--------------------------
i filled your public declaration instead of the wizard code and it ran to the commandline for me

for more info on starting this
http://www.ilopia.com/Articles/CSharp/IntroCSharp.aspx

hope this helps a bit
bruintje
Avatar of Dodger42
Dodger42

ASKER

Ok that worked thanks. Just one question though, when you use the build function within VS2005, should it output the program.exe to the project folder? I had to use csc for this example.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial