Chapter 3. Expressions and Control Structures


IN BRIEF

In this chapter, we will explore the basic control structures provided by C#. Each of these constructs will be explored and discussed in terms of syntax and proper usage.

WHAT YOU NEED

RECOMMENDED SOFTWARE

.NET Framework Visual Studio .NET

RECOMMENDED HARDWARE

.NET-enabled desktop client

SKILLS REQUIRED

C# coding


EXPRESSIONS AND CONTROL STRUCTURES AT A GLANCE

Expressions and Control Structures

53

  

Basic Expressions

53

  

Legal Variable Names

53

  

Using C# Operators

54

  

Pre/Post Operators

60

  

Program Flow Control: Control Structures

60

  
 

The Program Execution Path

60

Short Circuit Evaluation

62

 

Conditional Statements

60

Using the Ternary Operator

64

 

The if Control Structure

61

The switch Statement

65

 

The if/else Control Structure Combination

61

  

Looping

68

  
 

The for Loop

68

The while Loop

70

 

Using the for Statement

68

The do..while Loop

72

 

The foreach Statement

69

  




    Visual C#. NET 2003 Unleashed
    Visual C#. NET 2003 Unleashed
    ISBN: 672326760
    EAN: N/A
    Year: 2003
    Pages: 316

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net