Go to the Datasim Education BV homepage Datasim Education BV Datasim Education BV Datasim Education BV Datasim Education BV Datasim Education BV
Information request

Follow datasim on Twitter

Share this page

C# Training

Course Category: 

Generic Programming in C#  - (code CS-GEN)

C# is an object-oriented language and since version 2.0 it supports the generic programming model. This models Abstract Data Types (ADTs) which are defined as generic data and operations on that data. We see that the generic programming model is complementary to the object-oriented (OOP) model and in some cases it is more appropriate to use it.

This course has three goals. First, we introduce the foundations of generic programming (GP) and policy-based design and we show how to design a system using generic components. Second, we describe how C# supports the GP model by introducing syntax and giving appropriate examples. Finally, we discuss how to integrate GP with OOP to produce highly robust and reusable code and applications.

This course has been developed by Datasim based on real-life application development experience with the generic programming model in C# and other languages. This knowledge has been transferred to this course. The percentage theory/practice is this course is 65/35.

What do you learn?

  • How to use C# generics in applications
  • Integrating generics with OOP
  • Modelling reusable components with generics
  • Generic design patterns


Course contents updated May 2008

Course contents

Part I: Policy-Based Designs and Generics


  • What are Generics?
  • Generics versus traditional OO
  • Combining Generics and OO
  • Advantages of Generics
  • What Generics can not do

Policy-based Design in C#

  • Implementing contracts with interfaces
  • Combining behaviour and structure: interfaces and inheritance
  • Moving GOF patterns to their generic forms

Interfacing in C#

  • Interfaces and abstract classes
  • Provides and requires interfaces
  • Contracts and service-oriented programming
  • Contracts in C# (the where clause)

Defining Structure

  • Inheritance
  • Aggregation and Composition
  • Delegation: stateful and stateless variants

Generics in C#

  • Creating generic classes
  • Generic parameters
  • My first class
  • Using constraints between client and generic class
  • Using generic classes in your code

Inheritance and Generics

  • Deriving a generic class from another one
  • Deriving concrete classes (specific data type)
  • Generic abstract base classes
  • Generic interfaces

Part II: Core Syntax and Features

Generic Methods in C#

  • Why use generic methods?
  • Generic static methods
  • Generic operators and operator overloading
  • Where to apply generic methods

Generics and the .NET Framework

  • Impact on the .NET Framework
  • System libraries
  • Serialisation and generics
  • Generics and Remoting
  • GenericActivator

The Generic Collections

  • Improving on Object-based collections
  • Performance and type-safety
  • List <T>
  • Dictionary<K,T>
  • IEnumerable<T> and IEnumerator<T>
  • Stack <T>and Queue<T>

Generic Delegates

  • What is a delegate?
  • What is a generic delegate?
  • Using generic delegates for event handling
  • Generic Event Handlers

Part III: Intergration and Applications

Generics and Reflection

  • Introduction to reflection in C#
  • Extending reflection to support generics
  • The reflection API
  • Attributes and generics

Integrating Generics and OOP

  • Generic Interfaces and Inheritance
  • When to use GP and when to use OOP
  • Generic Design Patterns
  • Composition and Delegation

Generic Constraints

  • Ensuring type safety
  • Derivation, default constructor and reference/value constraints
  • Constraints and policy-based design
  • Provides and requires interfaces

Generic Serialisation and Deserialisation

  • Serialisation engines
  • Client-side serialisation
  • Explicit and implicit serialization

We assume that the reader has a reasonable knowledge of the C# language, for example classes, objects and inheritance. We take the student to the stage where he or she can write reusable and generic code and classes in C#.

Who should attend?
Developers who wish to learn how to implement the generic programming paradigm in C#. This course is also for those developers who extend the features in object-oriented technology to help them create reusable and generic code and classes. In fact, this course shows how to integrate these two paradigms into your applications. All source code based on the course will be provided.

Duration, price, date, locations
Course duration 2 days
Price Euro 970.-- ex. VAT
Euro 1173.70 inc. 21% VAT
Date and location Dates available on request

It is also possible to organize this course at your company premises (the in-company option). If you have any question, please contact our Datasim office.

Share this page

Contact and Profile
Registration form
Course Dates