Chapter 2 - C# Basics | |
bySimon Robinsonet al. | |
Wrox Press 2002 | |
Now that you understand a little more about what C# can do, you will want to learn how to use it. This chapter on the basics of C# will give you a good start in that direction by providing you with a basic knowledge of the fundamentals of C# programming, which we will build on in subsequent chapters. The main topics we will be covering are:
Declaring variables
Initialization and scope of variables
C#'s predefined data types
Dictating the flow of execution within a C# program using loops and statements
Calling and declaring classes and methods
Using arrays
Operators
Type safety and how to convert between data types
Enumerations
Namespaces
The Main() method
Basic command-line C# compiler options
Using System.Console to perform console I/O
Using commenting features in C# and Visual Studio .NET
C# identifiers and keywords
By the end of this chapter you will know enough C# to write simple programs, though without using inheritance or other object-oriented features. We will be exposing these details in the next few chapters of the book.