CS05 - C# Fundamentals - Primer / Programming Workshop - 5 days

View Dates and Locations

Course Description

This course covers all major aspects of programming with C#. It is essentially a condensed version of courses CS02 (C# Primer) and CS03 (C# Programming).


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.

The course also moves onto more advanced topics including Advanced Programming topics, Collections, Threads, I/O and Windows Applications.

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)
  • Take advantage of and understand Interfaces and Delegates
  • Understand and use Collections, ArrayLists and Dictionaries
  • Create and handle Exceptions
  • Use the C# Input/Output classes
  • Understand and use Serialization to achieve persistence
  • Understand multi-threading and synchronization and use the various techniques available to create separate threads

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.

On-site course enquiry (from £165 pp per day)

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 Object's 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 'this.' and 'base.' 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

ABSTRACT CLASSES AND INTERFACES
Abstract Classes and Methods
Interfaces
Defining an Interface
Implementing an Interface
Explicitly Implementing An Interface

ERROR HANDLING
C# Exceptions
Try / Catch Processing
The Finally Block
Passing Exceptions Up the Stack
The Throw Statement
Re-Throwing Exceptions
User Defined Exceptions

ADVANCED C# CONCEPTS
Delegates
Delegates: Anonymous Methods
Delegates: Lambda Expressions
Extensions Methods (.NET 3.0)
Operator Overloading
Indexers

COLLECTIONS
Collection Interfaces and Implementations
Generics
Summary Of Collection Implementations
Using Collection Classes - ArrayLists
Using Collection Initializers
Other ArrayList Methods
Generic List
Traversing Collections
Filtering Items From A List
Using Collection Classes - Hashtables
Looping around Hashtables
Generic Dictionaries
Dictionary Exceptions

LINQ TO OBJECTS
The Basics
LINQ with Custom Types
The Select Statement
GroupBy & Distinct

SORTING OBJECTS
Sorting Objects
The IComparable Interface
IComparers
SortedDictionary and SortedList
SortedList
SortedList
SortedDictionary

C# I/O
File and Directory manipulation
Simple Reading and Writing
Classes to Read / Write
BinaryReader
BinaryWriter
Serialization - Persistence of Objects
Serialization With XML

THREADS & SYNCHRONISATION
What is a Thread?
Creating Threads
Thread and ThreadStart
ParameterizedThreadStart
ThreadPool
CountdownEvent
ManualResetEvent
Delegates and Threads
Thread Synchronization
Thread Priority

ASYNCHRONOUS PROGRAMMING
Introduction to Async and Await
Using Async and Await

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

Interactive 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 gain experience of object oriented programming concepts.

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.


Availability

Course Enquiry