Difference between revisions of "Helloworld in csharp"

esse quam videri
Jump to: navigation, search
m (Text replacement - "syntaxhighlight lang="csharp" line="1" " to "syntaxhighlight lang="csharp"")
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Hello world in C#
 
Hello world in C#
# open a text editor (I like to use SCiTE)
+
# open a text editor (I like to use [http://www.scintilla.org/SciTE.html SCiTE])
 
# type in
 
# type in
:<csharp>using System;
+
:<syntaxhighlight lang="csharp">
 +
//HelloWorld in c#
 +
//
 +
//by Jeff Meyers jeff@iam.colum.edu
 +
 
 +
using System;
 
namespace HelloClass
 
namespace HelloClass
 
{
 
{
Line 13: Line 18:
 
         }
 
         }
 
     }
 
     }
}</csharp>
+
}</syntaxhighlight>
 
3 Save the file as HelloWorld.cs<br />
 
3 Save the file as HelloWorld.cs<br />
4 Coplile the .cs file using [[csc]] or [[msc]]<br />
+
4 Coplile the .cs file using [[csc]] or [[mcs]]<br />
 
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
+
* csc run the HelloWorld.exe created by csc <br>[[Image:CscHelloworld.png]]
** If you are using SCiTE and csc is setup correctlt in you enviromet variables you can just press
+
** If you are using SCiTE and your [[path enviroment 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 msc
+
* use mono to run the HelloWorld.exe created by mcs<br>[[Image:MscHelloworld.png]]
 
   mono HelloWorld.exe
 
   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
 +
 +
<pre>
 +
 +
<a href="http://iam.colum.edu/oop/gbrowser.php?file=/ExampleStudentSite/oop/Hw1/HelloWorld.cs">
 +
Home work One HelloWorld.cs
 +
</a>
 +
 +
</pre>
 +
 +
Post this link on you oop page
 +
 +
[[OOP Class1]]
 +
 +
[[Category:IAM Classes]][[Category:Object Oriented Programming]]

Latest revision as of 03:23, 9 February 2016

Hello world in C#

  1. open a text editor (I like to use SCiTE)
  2. type in
//HelloWorld in c#
//
//by Jeff Meyers jeff@iam.colum.edu

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

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