Difference between revisions of "Helloworld in csharp"

esse quam videri
Jump to: navigation, search
Line 1: Line 1:
 
Hello world in C#
 
Hello world in C#
1 open a text editor (I like to use SCiTE)
+
# open a text editor (I like to use SCiTE)
2 type in
+
# type in
 
+
:<csharp>using System;
<csharp>using System;
 
 
namespace HelloClass
 
namespace HelloClass
 
{
 
{
Line 15: Line 14:
 
     }
 
     }
 
}</csharp>
 
}</csharp>
3 Save the file as HelloWorld.cs
+
3 Save the file as HelloWorld.cs<br />
4 Coplile the .cs file using [[csc]] or [[msc]]
+
4 Coplile the .cs file using [[csc]] or [[msc]]<br />
 +
5 Use csc (windows) or mcs (*nix) ro compile<br />
 +
* csc run the HelloWorld.exe created by csc
 +
** If you are using SCiTE and csc is setup correctlt in you enviromet variables you can just press
 +
*** F7 to compile
 +
*** F5 to run
 +
* use mono to run the HelloWorld.exe created by msc
 +
  mono HelloWorld.exe

Revision as of 01:51, 11 January 2006

Hello world in C#

  1. open a text editor (I like to use SCiTE)
  2. type in
<csharp>using System;

namespace HelloClass {

   class HelloWorld
   {
       public static void Main()
       {
               Console.WriteLine("Hello World!");
               
       }
   }

}</csharp> 3 Save the file as HelloWorld.cs
4 Coplile the .cs file using csc or msc
5 Use csc (windows) or mcs (*nix) ro compile

  • csc run the HelloWorld.exe created by csc
    • If you are using SCiTE and csc is setup correctlt in you enviromet variables you can just press
      • F7 to compile
      • F5 to run
  • use mono to run the HelloWorld.exe created by msc
  mono HelloWorld.exe