Call Us: +32 2 466 00 16
Email: info@u2u.be
Follow Us:

Advanced Object-Oriented Programming Techniques in .NET

5 days
UNOOP
5 days

Upcoming Sessions

Date:

Format:

Price:

Location:

Book now

Date:

Format:

Price:

Location:

Book now

Date:

Format:

Price:

Location:

Book now

Date:

Format:

Price:

Book now

Interested in a private company training? Request it here.

Generics

C# generics provide a powerful way to create reusable code components that can work with any data type. They enable you to define classes, interfaces, methods, and delegates with placeholder types, allowing you to specify the actual types when you use them. This flexibility enhances code readability, reusability, and type safety.

  • Using Generics
  • Creating Generics
  • Constraints
  • Understanding Covariance and Contravariance
  • LAB: Building a Generic Graph

Delegates and Events

In C#, a delegate is a type that represents references to methods with a particular signature. Delegates provide a way to encapsulate and pass around methods as first-class objects. They are particularly useful in scenarios where you want to treat methods as data, such as callback mechanisms, event handling, multi-threading, asynchronous programming, and implementing functionality similar to function pointers in other programming languages.

  • Creating Delegates
  • Using Delegates
  • Multicast Delegates
  • Creating Events
  • Using Events in a UI
  • Understanding Closures and static lambda functions
  • LAB: Applying Top-down Actions on a Hierarchy

LINQ Fundamentals

LINQ (Language Integrated Query) is a feature of .NET that provides a consistent query syntax to query and manipulate data from different data sources, such as collections, arrays, databases, XML, and more. It allows developers to write queries directly within C# or other .NET languages, providing a more natural and intuitive way to work with data.

  • What is LINQ?
  • LINQ to Objects, SQL, Entity Framework and XML
  • LINQ's Enumerable Class
  • Query Syntax vs. Method Syntax
  • Deferred Query Evaluation with Yield Return
  • LINQ Operators
  • LINQ Internals
  • Extending LINQ with your own Operators
  • LAB: Exploring LINQ Features

Modern C# Language Features

The C# language itself has evolved dramatically over the last couple of years. If you have been struggling to keep up with all the details of these language features, this module is for you.

  • Nullable Reference Types
  • Value Tuples and discards
  • Pattern Matching
  • Global and Implicit Usings
  • Required and Init-Only Properties
  • Records
  • File-Scoped Types and Namespaces
  • Using Raw String Literals
  • Required Members
  • Generic Attributes
  • Specifying the Return Type for Lambda Functions
  • Primary constructors
  • Collection expressions, inline arrays and the spread operator
  • Aliasing types
  • LAB: Using ValueTuples with LINQ

Garbage Collection

When you create an object in .NET, the framework handles memory management for you. But what exactly happens with objects when .NET decides to remove them from memory? This is where Garbage Collection comes into play. In this module, we'll explore the significance of understanding Garbage Collection and why it's crucial to grasp its concepts accurately.

  • Allocating classes and structs - Heap vs. Call stack
  • The Lifecycle of a Class Instance
  • GC Class and Members
  • Forcing a Garbage Collection
  • Garbage Collection for Unmanaged Resources
  • The Dispose Pattern
  • Resurrection
  • Weak References

Reference Semantics with Value Types

Writing super-efficient code requires leveraging specific language features, which C# now offers. How can you efficiently pass value types? What strategies can you employ to avoid placing transient objects on the heap, opting instead to pass them on the stack? And, importantly, how do you measure the performance gain or loss?

  • Understanding Reference Semantics
  • How Value Types allow you to write faster code
  • Passing value types by reference with new access modifiers
  • Understanding Span<T> and related classes
  • Measuring performance using BenchmarkDotNet
  • LAB: Boosting Performance by using Reference Semantics

Concurrency

How does your machine handle multiple processes? How can a single process perform multiple tasks simultaneously? In this module, we'll explore the advantages and challenges associated with concurrency.

  • What is Concurrency?
  • Understanding Processes and Threads
  • Different Kinds of Concurrency
  • Scheduling Threads

Multithreading in .NET

Everyone begins by mastering the fundamentals. The Thread class represents the most fundamental approach to implementing concurrency. It's crucial to grasp this class's concepts to fully comprehend and appreciate the subsequent libraries and frameworks.

  • The Thread Class
  • Using the ThreadStatic attribute
  • Exceptions and Threads
  • Understanding Thread Pooling
  • Debugging Multi-Threaded Code

Thread Synchronization

Using shared memory in a multi-threaded environment can be dangerous and confusing. In this module, we'll explain what can go wrong and how to avoid it using different locking mechanisms.

  • Race Conditions and Dead Locks
  • Avoiding Race Conditions
  • Synchronizing Threads: Locks, Monitors, Signals, ...
  • Synchronization Guidelines
  • Thread Safety in .NET
  • LAB: Horse Race

Tasks

Using threads directly is quite complicated. Instead, we can make use of tasks to do our bidding. A Task represents an asynchronous operation or a unit of work that can be executed concurrently with other tasks. It's part of the Task Parallel Library (TPL) in .NET and provides a higher-level abstraction for asynchronous programming compared to using threads directly. There are again advantages and disadvantages to using this library, and we'll explore them in this module.

  • What are Tasks?
  • Task continuation
  • Waiting Asynchronously
  • Dealing with Exceptions
  • Task Cancellation

The Async and Await Syntax Explained

The async and await keywords are among the most commonly used language constructs in .NET. However, surprisingly few people understand their inner workings.

  • What is Asynchronous Programming?
  • Comparing async/await to other Asynchronous Constructs
  • Diving into the async and await Keywords
  • Understanding ValueTask and its advantages and uses
  • LAB: using Async and Await

Asynchronous Programming in .NET

After grasping the async and await keywords, you can delve into handling exceptions, managing cancellations, and tracking the progress of an async task. This module covers these topics in detail.

  • A History of Asynchronous Programming in .NET
  • Understanding SynchronizationContext
  • Cancellation, Progress and Exception Handling
  • ConfigureAwait
  • IAsyncEnumerable
  • Async Guidelines
  • LAB: Async and Await in a Library

Parallel Computing

In a multi-core environment, the ability to divide data so that each core can handle a separate task is incredibly valuable. This module delves into the functionality of Task Parallel Library (TPL) designed to facilitate this process.

  • What is Parallel Programming?
  • Writing Parallel Loops
  • Concurrent Collections
  • Parallel LINQ
  • LAB: Parallel Calculations, Parallel API calls

Reactive Extensions

Have you ever encountered Reactive Programming? This significant advancement teaches you to harness Observables for programming. Through this approach, you'll learn to address common challenges that traditional Object-Oriented Programming finds difficult to solve. Additionally, we will delve into the Fluxor/Redux pattern, further expanding our toolkit for managing complex application states.

  • Push vs. Pull
  • Understanding IObservable<T> and IObserver<T>
  • Hot and Cold Observables
  • IAsyncEnumerable versus Rx
  • What are Subjects?
  • Using LINQ with Rx
  • Combining Observables
  • What about timing?
  • LAB: Search Suggestions

Attributes and Reflection

In this module we'll talk about using attributes to add metadata to almost everything in .NET. Metadata is of course only useful if we can actually interpret it and that's where reflection comes into play. Reflection is a powerful feature used in a lot of libraries and applications.

  • What are Attributes?
  • Applying Attributes
  • Common Predefined Attributes
  • Building Custom Attributes
  • What is Reflection?
  • Retrieving Attribute Values
  • LAB: Task Scheduler

Expressions and Static Reflection

Making use of Expressions to dynamically create code that can be run when we want to, is very powerful. It is a feature used by LINQ for example to translate queries for a database or other system.

  • What are Expressions?
  • How does LINQ to Database work?
  • Using Static Reflection
  • Dynamically Generating Code with Expressions

Today's applications must be more responsive, scalable, and high-performing. Therefore, modern .NET developers need to be familiar with the advanced features of .NET and understand how things work under the hood. This course delves into advanced concepts of the framework, such as async programming, parallel computing, and Reactive Extensions. Join the training to enhance your existing .NET programming skills.

This in-depth course is meant for experienced developers who have a solid understanding of the .NET platform. All examples and labs are based on the latest LTS version of .NET and Visual Studio.

Contact Us
  • Address:
    U2U nv/sa
    Z.1. Researchpark 110
    1731 Zellik (Brussels)
    BELGIUM
  • Phone: +32 2 466 00 16
  • Email: info@u2u.be
  • Monday - Friday: 9:00 - 17:00
    Saturday - Sunday: Closed
Say Hi
© 2024 U2U All rights reserved.