Learning C# Part 1: Creating Your First Program

Written By: Kevin Jordan

- 28 Jun 2006 -
















Description: This series aims to take a beginning programmer to an intermediate level in C#. Topics covered in Part 1 include: a brief intro to the .NET Framework, customizing Visual Studio, the stages of the development process, creating a new Windows application project, using the Forms designer, and running the application.

  1. Intro To .NET and Visual Studio
  2. The Stages of the Development Process
  3. Creating a Windows Application
  4. Using the Forms Designer and Running the App
  5. Aww Man... Not Homework

Introduction

The goal of these articles is to take a beginning programmer to an intermediate level in C#. By the end of this series you should be able to use object oriented to techniques to create database or xml driven websites and Windows-based applications.

I think practice problems can provide a significant benefit rather than just reading material because that's where you realize if you really understand a concept or not. So, at the end of each section there will be a small practice. If you run into any problems along the way, feel free to , or post it on the forum.

A Very Brief Intro to the .NET Framework

The first thing any C# book or class will tell you before you dive in is how great C# and the .NET framework are. Personally, this is a waste to me, since I've already made the decision at that point to learn the language anyway. So I'm going to skip over the benefits of the .NET and only briefly describe how it all works. It's important, but it won't really make you a better programmer at this stage of your development.

Basically the .NET Framework is divided into two sections: the class library (which makes your programming a lot faster) and the common language runtime (which handles the execution of your code). When you compile the application, your code is translated into an intermediate language called MSIL (Microsoft Intermediate Language). All .NET compatible languages are first translated to MSIL so that you can use code from multiple languages within the same program.

Customizing Visual Studio

If you're using Visual Studio as your IDE (integrated development environment), then there are a couple things that may be helpful to you. First off, there's IntelliSense. IntelliSense is one of the main reasons to use an IDE. It's a convenient way to auto-complete variables and access descriptions of methods and there parameters. To use IntelliSense, use Ctrl + Space Bar while you're typing either a variable, method, class. It'll pop up with a drop down that has options matching the letters you've typed thus far.

Something else I like to do is change the color of my strings in order to help distinguish them within my code. To do this go to Tools >> Options >> Fonts and Colors. From there you can change the color of any element within Visual Studio.

Next >>