Category: Variables Essentials

Variables Essentials

String Manipulation

String Manipulation

Your use of strings so far has consisted of writing strings to the console, reading strings from the console, and concatenating strings using the + operator. In the course of programming more interesting applications,...

foreach Loops

foreach Loops

A foreach loop enables you to address each element in an array using this simple syntax: foreach ( < baseType > < name > in < array > ) { // can use <...

Structs

Structs

Structs are data structures are composed of several pieces of data, possibly of different types. They enable you to define your own types of variables based on this structure. For example, suppose that you...

Convert Commands C#

Convert Commands C#

The type of explicit conversion you have been using in many of the Try It Out examples is a bit different from those you have seen so far in these tutorials. You have been...

Explicit Conversions C#

Explicit Conversions C#

As the name suggests, an explicit conversion occurs when you explicitly ask the compiler to convert a value from one data type to another. Because of this, they require extra code, and the format...

Implicit Conversions

Implicit Conversions

Implicit conversion requires no work on your part and no additional code. Consider the code shown here: This assignment may involve an implicit conversion if the type of var2 can be implicitly converted into...