C# Language Basics

Feb 6 2009 3:58 AM

C# Language Basics

This article provides an overview of the C# Language. The various elements and building blocks of the C# language are explained.


Background

What is C# all about?

C# was developed at Microsoft. It is an object-oriented programming language and provides excellent features such as strong type checking, array bounds checking and automatic garbage collection. We will explore these and several other features in this article.


C# has features that make it an excellent choice for developing robust distributed n-tier Enterprise applications, web applications, windows applications and embedded systems. It is used for building applications ranging from the very large that use sophisticated operating systems, down to the very small having specialist functions


Getting Started:

Here is a very simple “Hello World” program written using C#. The code for C# program is written in text files with an extension “.cs”
Example:
1) Create a text file “First.cs”
2) Type the following code and ‘save’


using System;
class myClass
{
static void Main()
{
Console.WriteLine("Hello World");
}
}

3) From the command line compile the above code by typing the following
csc First.cs
4) This creates First.exe
5) Run this exe from the command line and you see an output –
Hello World


Having seen the example above we will now review the

concepts and elements of the C# programming language. After that we will review the above example once again to understand what each line of code does. To get a better grasp of the C# language it is helpful if you have some programming experience and even better if you have experience in Object Oriented Programming.



web development services


Answers (2)