Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
Search :       Advanced Search �
Home

Author Rank :
Page Views :
Downloads : 0
Rating :
 Rate it
Level :
Become a Sponsor
Tags


We can develop a C# standalone program or console application using an Integrate Development Environment (IDE) like Visual Studio or using a plain text editor like Notepad, Wordpad etc. The following shows how to do that using a text editor for a simple "Hello World" program. First of all set the path for the C# Compiler (using Windows 7).

1. Right-click Computer and click on Properties from Drop-Down Pane.

2. Now Control Panel Home open and click on Advanced system settings.

texteditor1.jpg 
 
Fig 1. Control Panel Home

3. A new window System Properties opens. Click on the Advanced Tab and click on Environment Variables. 

texteditor2.jpg
  
Fig 2 System Properties

4. A new window for Environment Variables opens. 

texteditor3.jpg
 
Fig 3 Environment Variable

5. There are two parts:
  • User variables
  • System variables    
Under the User variables Pane click on the New button. A window New User Variable opens; it has two parameters:
  • Variable name 
  • Variable value
In the Variable name write path. For the Variable value write the C# compiler path, such as: 

C:\Windows\Microsoft.NET\Framework64\v3.5

texteditor4.jpg
 
Fig 4 New User Variable

6. In the New User Variable Window click the OK button then for the Environment Variables window click the OK button then for the System Properties window click the OK button.

7. Open a Command Prompt and type in the command csc and press ENTER.

If following prompt appears then that means your C# compiler 3.5 path is correct.

texteditor5.jpg 

Fig 5 Path Varification

8. Type the following code with any Text Editor (Notepad, WordPad, etc):

class HelloWorld
 {
static void Main()
 {
System.Console.Write("Hello World");
 }
  }

9. Save the file at any location of the hard drive with class name and .cs extension. Open a Command Prompt window and compile HelloWorld.cs class using following command:

csc file-name 

for example csc HelloWorld.cs 

After successful compilation the HelloWorld.cs file's executable file HelloWorld.exe is created; now run this .exe file using the following command:

filename

for example HelloWorld.exe

Or 

HelloWorld

Now our output is 

texteditor6.jpg 

Fig 6 Output

 [Top] Rate this article
 
 About the author
 
Author
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
 Comments

 � 2022  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.