Helloworld in csharp

esse quam videri
Revision as of 18:29, 25 January 2016 by Jeff (talk | contribs) (Text replacement - "<csharp>" to "<syntaxhighlight lang="csharp" line="1" >")
Jump to: navigation, search

Hello world in C#

  1. open a text editor (I like to use SCiTE)
  2. type in
<syntaxhighlight lang="csharp" line="1" >

//HelloWorld in c# // //by Jeff Meyers jeff@iam.colum.edu

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

6 Post to your oop folder. I would make a folder called "Hw1". Then you should make a link to you file using the source browser like this


<a href="http://iam.colum.edu/oop/gbrowser.php?file=/ExampleStudentSite/oop/Hw1/HelloWorld.cs">
Home work One HelloWorld.cs
</a>

Post this link on you oop page

OOP Class1