CS02 - C# Primer - 3 Days

Course Description

This course is designed for the novice developer or those with little or no experience of C# who require an introduction to the C# language using the Microsoft Visual Studio IDE.


Pre-requisites

The student should be familiar with the Windows host environment. Knowledge of any programming language is advantageous but not essential.


Objectives

This course provides students with the skills to write simple C# programs. The syntax of the language is covered in detail and also Object Oriented coding techniques are discussed.

During the course the student will write many applications to ensure that the concepts and statements taught are fully understood and practical experience is gained.

The course is taught using Microsoft's Visual Studio IDE. The skills needed to use this software are presented as part of the course.

On completion of this course the student will be able to:

  • use the major concepts of a modern, block-structured, high-level language, such as control flow, function calls and modular programming
  • structure programs using classes and other essential object-oriented features
  • create, test and debug simple C# code using the Visual Studio Integrated Development Environment (IDE)


Environment

Development will be performed using:

  • Microsoft Visual Studio


Customisation

For on-site courses (i.e. at your premises), we are more than happy to tailor the course agenda to suit your exact requirements. In many cases, we are able to build your in-house standards and naming conventions into the delivered course.


Course Details

MICROSOFT .NET PLATFORM
Goals of .NET
Overview of .NET
The .NET Framework
Development Tools

INTRO TO C#
The "Hello World" Application

OBJECT-ORIENTED CONCEPTS
What Is an Object?
The Benefits of Encapsulation
Sending Messages to an Object - Methods
The Benefits of Messages
What Are Classes?
Objects vs. Classes
The Benefit of Classes
What Is Inheritance?
The Benefits of Inheritance

DATA TYPES AND VARIABLES
Variables
Value Types
Literal Values
Variable Naming and Standards
Variable Initialisation
Reference Types
Predefined Reference Types
Nullable Types
Variable Usage Types
Variable Scope
Constant Variables
Read-Only variables
Escape Characters
Passing Arguments to C# Programs

ARITHMETIC AND BITWISE MANIPULATION
Arithmetic Operators
Unary Operations
Bitwise Operators
Assignment Operators
Expressions
Literal Values
Casting
Implicit Casting
Casting with Operators
Checked Keyword
Decimal Precision

OBJECTS, METHODS AND CLASSES
Introduction to Classes and Objects
Methods
A Complete Example
Break Down of Complete Example:
Combining Application / Object Code
Creating Objects
Manipulating Objects - Variables vs methods
Method Syntax
Calling an Objectxxs Methods
Returning Values from Methods
Encapsulation
Properties
Object Initializers
Anonymous Types
Named Arguments
Passing Arguments and Method Overloading
Default Parameters and Named Arguments
Variable Argument (params) Methods
Pass By Value / Reference
The ref keyword
Passing Arguments - Under the Bonnet
Using the xxthis.xx and xxbase.xx Prefix
The out keyword
Static Variables and Methods
Static properties
Constructors
Constructor Example
Constructor Syntax
Constructor Rules
Constructor Chaining
Static Constructors
Cleaning Up Unused Objects - The Garbage Collector
Destructors

STRUCTURES
Structs
Using Structs
Features of C# Structures
Structure Methods

ENUMS
Enumerations
Passing Enums to Methods
Changing the Enum Mapping

CONTROL FLOW STATEMENTS
Relational Operators
Conditional Operators
Control Flow Statements
The if-else Statement
The Ternary Expression
The switch Statement
For Loop Statements
ForEach Loop
While loop Statements
Do-while loop Statements
Breaking out of Loops: break and continue
The Goto Statement

STRINGS
Strings
Literal Strings
String Methods
String Concatenation
Testing for String equality
String Manipulation - the StringBuilder class

INHERITANCE
Inheritance - Extending a Class
What does a Derived class Inherit?
Inherited Methods in System.Object

ARRAYS
Arrays
Allocating Storage for an Array
Multi-Dimentional Arrays
Arrays of Objects
Passing Arrays as Arguments
Array Utilities
Splitting and Joining Strings

NAMESPACES AND ASSEMBLIES
Namespaces of the C# Platform
Namespaces
Using Namespace Members
The USING keyword
Aliases
Assemblies

C# KEYWORDS AND ACCESSIBILITY MODIFIERS
Class Declaration Parameters
Variable Declaration Parameters
Method Declaration Parameters

CONVERSION AND FORMATTING
Data Type Conversion
Boxing and Unboxing
Numeric Formatting
Date Formatting

OBJECT CASTING
Casting Objects
Overriding Methods and Casting

UNIT TESTING
MSTest and NUnit Introduction
Installing the NUnit Framework
MSTest and NUnit Testing
MSTest and NUnit Assert Methods
Running MSTest and NUnit
Initialisation and Cleanup
Testing for exceptions

THE VISUAL STUDIO DEVELOPMENT ENVIRONMENT
The Workbench
Solution Explorer, Class View, Toolbars
Searching, Rearranging Views
Working With C#
Fixing Problems, Creating new Classes and Interfaces
References
The C# Editor
Editing code and elements, IntelliSense, Code Formatter
Running and Debugging apps


Course Format

Practical sessions make up a large part of the course, allowing delegates to demonstrate and reinforce the lectures given. During these sessions the delegate will build a simple but complete application.

Examples are used extensively, ranging from simple code 'snippets' to full applications with complete 'real world' functionality. These are supplied at the start of the course and it is encouraged that the delegates execute and 'experiment' with these under the instructor's guidance as they are introduced.

These examples are available to take away, along with the delegate's own work.

The comprehensive Student Guide supplied is fully indexed serving as a useful reference tool long after the course has finished. Delegates will also be able to access a free help-line with technical questions relating to topics covered on the course.


Course Enquiry