Labels

http://96b9164e.linkbucks.com

Sunday 24 February 2013

The command-line is a window that allows you to run commands and programs by typing the text in manually. It is often refered to as the DOS prompt, which was the operating system people used years ago, before Windows. The .NET Framework SDK, which is free, uses mostly command line tools. Therefore, I wrote this tutorial so that anyone would be able to use it. Do a search through Windows Explorer for "csc.exe", which is the C# compiler. When you know its location, add that location to your Windows path. Then open the command window by going to the Windows Start menu, selecting Run, and typing cmd.exe. This blog post might be helpful: How to set the path in Windows 7.
The first thing you should be aware of is that C# is case-sensitive. The word "Main" is not the same as its lower case spelling, "main". They are different identifiers. If you are coming from a language that is not case sensitive, this will trip you up several times until you become accustomed to it.
The namespace declaration, using System;, indicates that you are referencing the System namespace. Namespaces contain groups of code that can be called upon by C# programs. With the using System; declaration, you are telling your program that it can reference the code in the System namespace without pre-pending the word System to every reference. I'll discuss this in more detail in Lesson 06: Namespaces, which is dedicated specifically to namespaces.

Lesson 1: Getting Started with C#

This lesson will get you started with C# by introducing a few very simple programs. Here are the objectives of this lesson:
  • Understand the basic structure of a C# program.
  • Obtain a basic familiarization of what a "Namespace" is.
  • Obtain a basic understanding of what a Class is.
  • Learn what a Main method does.
  • Learn how to obtain command-line input.
  • Learn about console input/output (I/O).

A Simple C# Program