Difference between revisions of "Helloworld in csharp"

esse quam videri
Jump to: navigation, search
Line 1: Line 1:
 +
[[category:oop]]
 
Hello world in C#
 
Hello world in C#
 
# open a text editor (I like to use [http://www.scintilla.org/SciTE.html SCiTE])
 
# open a text editor (I like to use [http://www.scintilla.org/SciTE.html SCiTE])
Line 18: Line 19:
 
5 Use csc (windows) or mcs (*nix) ro compile<br />
 
5 Use csc (windows) or mcs (*nix) ro compile<br />
 
* csc run the HelloWorld.exe created by csc <br>[[Image:CscHelloworld.png]]
 
* csc run the HelloWorld.exe created by csc <br>[[Image:CscHelloworld.png]]
** If you are using SCiTE and your path enviromet variables are setup correctlty you can just press
+
** If you are using SCiTE and your [[path enviromet variables for csc]] are setup correctlty you can just press
 
*** F7 to compile <br>[[Image:HelloWorldSciteCompile.png]]
 
*** F7 to compile <br>[[Image:HelloWorldSciteCompile.png]]
 
*** F5 to run <br>[[Image:HelloWorldSciteRun.png]]
 
*** F5 to run <br>[[Image:HelloWorldSciteRun.png]]
 
* use mono to run the HelloWorld.exe created by mcs<br>[[Image:MscHelloworld.png]]
 
* use mono to run the HelloWorld.exe created by mcs<br>[[Image:MscHelloworld.png]]
 
   mono HelloWorld.exe
 
   mono HelloWorld.exe

Revision as of 01:15, 23 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 mcs
5 Use csc (windows) or mcs (*nix) ro compile

  • csc run the HelloWorld.exe created by csc
    CscHelloworld.png
  • use mono to run the HelloWorld.exe created by mcs
    MscHelloworld.png
  mono HelloWorld.exe