Introduction to C#
Learning a new programming language could be an intimidating factor, especially if you are new to programming. Some people think that coding a program and the output it brings is magic. But the actual story is that it is an art and piece of science. The way to become a successful programmer and a keen programming enthusiast is to learn things in step wise. It is essential to get to know the basics of any programming language if you want to be a successful programmer on it. When you get addicted to programming it will be fun and will start to enjoy it a lot. In this series we will be concentrating on C# and how to create nice applications from it. You will understand that C# is quite easy to follow and it is enjoyable.
C# is a programming language which developers can use to develop Windows based applications. As you have experienced with other programming languages there is no need to install separate compliers in C#. Furthermore when running the code, manual compilation is not required. The reason for that is that C# comes with the .NET framework developed by Microsoft Corporation. So as a user what you really want to do is to install .NET framework in your machine, with that all the components which you need to develop (code, compile and run) C# programs would be installed. We’ll see how we can install C#.NET in your computer later in this session. Before that let’s gather some information about the history and evolution of the .NET framework.
Before diving deeper into the pool of C#.NET, let’s get a small idea about the history of it and how C#.NET became the popular piece of technology as it is now.
In and around 1997 Microsoft started the work on .NET. By that time the .NET framework was called “codename Project 42″ and “project Lightning”. During that time Microsoft was starting to face some problems, they were criticized about Visual Basic; they lost ground against Java and C++ and at the same time Sun Microsystems plus the US government open cases against Microsoft in charges of monopoly and copyrights. To overcome these issues Microsoft came up with C#. Since then .NET had improved with leaps and bounds. And comprises with many languages and technologies like ASP, Visual C++ and J#. The name “C#”(C sharp) came from the musical term “#”. In musical language the sign “#” means: A semi-tone over the note. The intention behind that original name was to be shown that C# is a little bit better than C++, just like C++ used the “++” sign to express its power over C.
However, apart of its metaphysical “power” C# really differs from C++ and other languages. And it’s without a doubt one of the best languages nowadays. And many developers are using C# to develop Windows based applications over languages like Java, C++, etc…
All these languages have characteristics of their own and the usefulness of each language changes from the applications which it is used. But C# and addition of .NET Framework has brought an extra dimension to C# and it has immensely helped to increase its popularity.
Here are some reasons why C# outscores some of its counterparts like C++ and Java.
- C# comprises of four paradigms, those are: functional, imperative, generic, and object-oriented (class-based). For comparison Java has only 3 paradigms while PHP and C++ only 2 paradigms.
- Languages like C++ and java didn’t have an advance IDE like what C# has. Now Java has Netbeans.
- C# is better in some other ways as well, Visual Studio comprises of a ‘Garbage Collector’ and unlike in C++, pointers (Very Helpful, but complicating at times) are removed.
- C# is Object oriented, so classes are used in building programs (Which will be discussed later in detail).
- ASP.NET is also a part of .NET Framework, so C# programs can be easily embedded with Web pages designed from ASP.
C#.NET has gradually evolved to the current state from its beginning. As mentioned above learning C# is easy. To start doing it you only need a single program called Microsoft Visual Studio. All the required components which you need to code, compile, run and debug C# code is embedded with it.
Thus far Visual Studio has come with versions like, Visual Studio 2003, Visual Studio 2005 and Visual Studio 2008. These get a Visual Studio copy as a commercial edition or as a free edition. But this tutorial series would be using the free edition of the Visual Studio which is the Visual Studio 2008 Express Edition. If necessary you can always go for a commercial edition of Visual Studio even.
Setting up the Computer for C#
In case if you don’t have a copy of Visual Studio Express Edition you can download it from here.
- Visual C# is usually presented with as a ‘Green Box’
- You can either save the installer into your machine or download it directly.
Here’s a brief description about the installation process.
This is the screen which appears at the beginning, click next and move to the next one
Accept the Agreement statement and move to the Next step.
Select the version you want to install and move to the Next step
Browse the location in your machine to install.
Then the installation process would continue.
After the installation process you would be asked to restart the machine. Do it as it says.
Now you are ready start learning C#.NET.
- After you have started the Visual studio, open new project. On the main menu click File/New project.
- Now on the window that appears, choose on : “Windows forms application” and Click ‘Ok’
Figure: 1_6: Starting Screen of c#.net
- Then a screen similar to this would appear.
To get a broader view and understanding about C# and Microsoft Visual Studio you can visit http://www.learnvisualstudio.net/ and download video tutorials.
Now you can start coding your First C# program. But we will start doing that in our next session.
Till then have a nice time. Thank you…