Summary
This chapter examined some of the basic
syntax of C#, covering the areas needed to write simple C#
programs. It has covered a lot of ground, but much of it will be
instantly recognizable to developers who are familiar with any
C-style language (or even JavaScript). Some of the topics covered
include:
-
Variable scope and access levels
-
Declaring variables of various data types
-
Controlling the flow of execution within a C#
program
-
Comments and XML documentation
-
Preprocessor directives
-
Usage guidelines and naming conventions, the
guidelines that you should adhere to when writing C# code, so that
your code follows normal .NET practice and can be easily understood
by others
You have seen that C# syntax is similar to C++ and
Java syntax, although there are many minor differences. You have
also seen that in many areas this syntax is combined with
facilities to write code very quickly, for example high-quality
string handling facilities. C# also has a strongly defined type
system, based on a distinction between value and reference types.
Chapters 3 and 4 cover the C# object-oriented programming
features.