C# STEP BY STEP
Microsoft Visual Studio
Step By Step
C# STEP BY STEP
Microsoft Visual C# is a powerful but simple language aimed primarily at developers creating applications by using the Microsoft .NET Framework. It inherits many of the best features of C++ and Microsoft Visual Basic, but few of the inconsistencies and anachronisms, resulting in a cleaner and more logical language. The advent of C# 2.0 has seen several important new features added to the language, including Generics, Iterators, and anonymous methods. The development environment provided by Microsoft Visual Studio 2005 makes these powerful features easy to use, and the many new wizards and enhancements included in Visual Studio 2005 can greatly improve your productivity as a developer.
The aim of this book is to teach you the fundamentals of programming with C# by using Visual Studio 2005 and the .NET Framework. You will learn the features of the C# language, and then use them to build applications running on the Microsoft Windows operating system. By the time you complete this book, you will have a thorough understanding of C# and will have used it to build Windows Forms applications, access Microsoft SQL Server databases, develop ASP.NET Web applications, and build and consume a Web service.
Introducing Microsoft Visual C# and Microsoft Visual Studio 2005 Chapter 1
Welcome to C#
After completing this chapter, you will be able to:
Use the Visual Studio 2005 programming environment.
Create a C# console application.
Create a C# Windows Forms application.
Microsoft Visual C# is Microsoft's powerful, component-oriented language. C# plays an important role in the architecture of the Microsoft .NET Framework, and some people have drawn comparisons to the role that C played in the development of UNIX. If you already know a language such as C, C++, or Java, you'll find the syntax of C# reassuringly familiar because it uses the same curly brackets to delimit blocks of code. However, if you are used to programming in other languages, you should soon be able to pick up the syntax and feel of C#; you just need to learn to put the curly brackets and semi-colons in the right place. Hopefully this is just the book to help you! In Part I, you'll learn the fundamentals of C#. You'll discover how to declare variables and how to use operators such as plus (+) and minus (-) to create values. You'll see how to write methods and pass arguments to methods. You'll also learn how to use selection statements such as if and iteration statements such as while. Finally, you'll understand how C# uses exceptions to handle errors in a graceful, easy-to-use manner. These topics form the core of C#, and from this solid foundation, you'll progress to more advanced features in Part II through Part VI.
C# STEP BY STEP
Beginning Programming with the Visual Studio 2005 Environment Visual Studio 2005 is a tool-rich programming environment containing all the functionality you'll need to create large or small C# projects. You can even create projects that seamlessly combine modules from different languages. In the first exercise, you'll start the Visual Studio 2005 programming environment and learn how to create a console application.
Create a console application in Visual Studio 2005
1. In Microsoft Windows, click the Start button, point to All Programs, and then point to Microsoft Visual Studio 2005.
2. Click the Microsoft Visual Studio 2005 icon. Visual Studio 2005 starts. NOTE
If this is the first time that you have run Visual Studio 2005, you might see a dialog box prompting you to choose your default development environment settings. Visual Studio 2005 can tailor itself according your preferred development language. The various dialog boxes and tools in the integrated development environment (IDE) will have their default selections set for the...