Category: Variables and Expressions

Variables and Expressions

Arrays in C#

Arrays in C#

Arrays are indexed lists of variables stored in a single array type variable. For example, you might have an array called friendNames that stores the three names shown above. You can access individual members...

Enumerations

Enumerations

Each of the types you ’ ve seen so far (with the exception of string ) has a clearly defined set of allowed values. Admittedly, this set is so large in types such as...

Namespaces in C#

Namespaces in C#

Before moving on, it ’ s worthwhile to consider one more important subject — namespaces . These are the .NET way of providing containers for application code, such that code and its contents may...

Variable Naming in C#

Variable Naming in C#

As mentioned in the previous section, you can ’ t just choose any sequence of characters as a variable name. This isn ’ t as worrying as it might sound at first, however, because...

Simple Types

Simple Types

Simple types include types such as numbers and Boolean (true or false) values that make up the fundamental building blocks for your applications. Unlike complex types, simple types cannot have children or attributes. Most...

Variables in C#

Variables in C#

To use variables, you have to declare them. This means that you have to assign them a name and a type . Once you have declared variables, you can use them as storage units...

Comments in C#

Comments in C#

To indicate comments using the first method, you use /* characters at the start of the comment and */ characters at the end. These may occur on a single line, or on different lines,...

Basic C# Syntax

Basic C# Syntax

C# is a block – structured language, meaning statements are part of a block of code. These blocks, which are delimited with curly brackets ( { and } ), may contain any number of...