A Guided Tour through C#: Part I
You will learn about the following in this chapter:
The advantages of applying two important OOP conceptsabstraction and encapsulation
Why the C# keywords public and private play an important role in implementing encapsulation
The basic C# elements needed to write simple C# applications
How to write a user interactive application using simple keyboard input and screen output
Single line comments and why comments are important in your source code
The special meaning of keywords
How to define the beginning and the end of a class and method body by using C#'s block construct
How to use C#'s if statement to make your program respond in different ways to different user input
The string class and its ability to let your programs store and process text
The special role played by the Main method
The static keyword and why Main must always be declared public and static
How to use variables
How to call a method and thereby use its functionality
Several useful classes from the .NET Framework class libraries and how to reuse these in the C# source code
Statements in C#the declaration, assignment, method call, and if statements
General C# concepts based on the knowledge gained from the C# source code example
How to access and use the .NET Framework Documentation so you can explore and reuse the .NET Framework's comprehensive collection of classes
Introduction
Each language construct of a C# program does not exist in isolation. It has its own vital part to play but is also closely interrelated with other elements. This makes it difficult to look at any one aspect of C# without requiring the knowledge of others. Due to this circular dependence among the elements of C#, this chapter, along with Chapter 4, "A Guided Tour Through C#: Part II," and Chapter 5, "Your First Object-Oriented C# Program," presents an overview of several important features, to give you an introductory feel for the language.
The presentation is facilitated by C# source code examples containing several essential elements of C#. Each element will be presented, discussed, and related to other parts of the C# program in a practically related fashion. This will enable you to start writing your own programs during this chapter. I hope you will grab this opportunity to play with and explore C#. Some of the most important parts of this and the following two chapters are the programming exercises at the end of each chapter. You don't become a proficient C# programmer just by learning lots of definitions by heart but by doing and unleashing your creativity. So have a go at these exercises and use your imagination to come up with other ideas of how to improve the programs or, even better, create your own programs.