Datasheet
Introducing C#
15
C# in This Book
The second and third sections of this book deal with the syntax and usage of the C# language without
too much emphasis on the .NET Framework. This is necessary, as we won't be able to use the .NET
Framework at all without a firm grounding in C# programming. We'll start off even simpler, in fact, and
leave the more involved topic of Object-Oriented Programming (OOP) until we've covered the basics.
These will be taught from first principles, assuming no programming knowledge at all.
Once we have done this, we will be ready to move on to developing the types of application listed in
the last section. Section four of this book will look at Windows Forms programming, section five will
look at some other .NET topics of interest (such as accessing databases), and section six will look at web
application and web service programming. Finally, we'll have a look at some more involved case studies
that make use of what we have learned in the earlier parts of the book.
Visual Studio .NET
In this book we'll use Visual Studio .NET (VS) for all of our C# development, from simple command
line applications, to the more complex project types considered. VS isn't essential for developing C#
applications, but it makes things much easier for us. We can (if we wish to) manipulate C# source code
files in a basic text editor, such as the ubiquitous Notepad application, and compile code into assemblies
using the command line compiler that is part of the .NET Framework. However, why do this when we
have the full power of VS to help us?
The following is a quick list of some of the features of VS that make it an appealing choice for
.NET development:
❑ VS automates the steps required to compile source code, but at the same time gives us
complete control over any options used should we wish to override them.
❑ The VS text editor is tailored to the languages VS supports (including C#), such that it can
intelligently detect errors and suggest code where appropriate as we are typing.
❑ VS includes designers for Windows Forms and Web Forms applications, allowing simple drag-
and-drop design of UI elements.
❑ Many of the types of project possible in C# may be created with "boilerplate" code already in
place. Instead of starting from scratch, we will often find that various code files are started off
for us, reducing the amount of time spent getting started on a project.
❑ VS includes several wizards that automate common tasks, many of which can add appropriate
code to existing files without us having to worry about (or even, in some cases, remember) the
correct syntax.
❑ VS contains many powerful tools for visualizing and navigating through elements of our projects,
whether they are C# source code files, or other resources such as bitmap images or sound files.
❑ As well as simply writing applications in VS, it is possible to create deployment projects,
making it easy to supply code to clients and for them to install it without much trouble.
❑ VS enables us to use advanced debugging techniques when developing projects, such as the ability
to step through code one instruction at a time while keeping an eye on the state of our application.