About this book

For Instructors

More books by us

For Students



Sample Chapters

Download C# system, and code

Bonus Database Chapter

This book is for novices

If you have never done any programming before - if you are a complete novice - this book is for you. This book assumes no prior knowledge of programming. It starts from scratch. It is written in a simple, direct style for maximum clarity. It is aimed at first level students at universities and colleges, but it is also suitable for novices studying alone.

Why C#?

C# is arguably one of the best programming languages to learn and use in the 21st century, because:

  • Object-oriented languages are the latest and most successful approach to programming.
    C# is completely object-oriented from the ground up.
  • C# is a completely general-purpose language - anything that Visaul Basic, C++, Java, and Ada can do, so can C#.
  • C# gains most of its functionality from components provided a library

You will need

To learn to program you need a PC running Windows and the software that allows you to prepare and run C# programs in a convenient way. There are two Microsoft versions of the software - Visual C# .NET (for C# alone) and Visual Studio .NET (a more fulsome package).

The approach of this book

We explain how to use objects early in this book. Our approach is to start with the ideas of variables, assignment and methods, then introduce using objects created from library classes. Next we explain how to use control structures for selection and looping. Then comes the treatment of how to write your own classes.

We wanted to make sure that the fun element of programming was paramount, so we use graphics right from the start. We think graphics is fun, interesting and clearly demonstrates all the important principles of programming. But we haven't ignored programs that input and output text - they are also included.

The programs we present use many of the features of a graphical user interfaces (GUIs), such as buttons, scroll bars and text boxes. But we also explain how to write console programs in C#.

We introduce new ideas carefully one-at-a-time, rather than all at once. So, for example, there is a single chapter on writing methods. We introduce simple ideas early and more sophisticated ideas later on.

What's included?

This book explains the fundamental ideas of programming:

  • variables
  • assignment
  • input and output using a graphical use interface (GUI)
  • calculation
  • repetition
  • selection between alternatives

It explains how to use numbers and character strings. Arrays are also described. These are all topics that are fundamental, whatever kind of programming you do. This book also thoroughly explains the object-oriented aspects of programming - using objects, writing classes, methods and properties, and using library classes. We also look at some of the more sophisticated aspects of object-oriented programming including inheritance, polymorphism and interfaces.

 What's not included

This book confines itself to the essentials of C#. It does not explain all the bits and pieces, the bells and whistles. Thus the reader is freed from unnecessary detail and can concentrate on mastering C# and programming in general.


The Unified Modeling Language (UML) is the current mainstream notation for describing programs. We use elements of UML selectively, where appropriate, throughout this book


Computers are used in many different applications and this book uses examples from all areas including:

  • games;
  • information processing;
  • scientific calculations.

We have also included a few exercises which look at the exciting idea of artificial life.

The reader can choose to concentrate on those application areas of interest and ignore other areas.

Exercises are good for you

If you were to read this book time and again until you could recite it backwards, you still wouldn't be able to write programs. The practical work of writing programs is vital to becoming fluent and confident at programming.

There are exercises for the reader at the end of each chapter. Please do some of them to enhance your ability to program.

There are also short self-test questions throughout the text, so that you can check you have understood things properly. The answers are given at the end of each chapter.

Have fun

Programming is creative and interesting, particularly in C#. Please have fun!

Visit our Web site

The web site includes:

  • the text of all the programs in this book
  • a discussion forum for students
  • additional resources for instructors

Our Web site can be reached via the Pearson Education web site