Advanced C#: Thread-Safe Data with Concurrent Collections

Go to class
Write Review

Free Online Course: Advanced C#: Thread-Safe Data with Concurrent Collections provided by LinkedIn Learning is a comprehensive online course, which lasts for 1-2 hours worth of material. The course is taught in English and is free of charge. Upon completion of the course, you can receive an e-certificate from LinkedIn Learning. Advanced C#: Thread-Safe Data with Concurrent Collections is taught by Walt Ritscher.

Overview
  • Learn how to work with the thread-safe concurrent collections to share data across threads and build scalable applications.

Syllabus
  • Introduction

    • Thread-safe data with concurrent collections
    • What you should know
    • How to access the sample code on GitHub
    1. Defining the Problem
    • Collections and threads
    • Use Queue with single thread
    • Use Queue with multiple threads
    • Debug the Queue multiple-thread problem
    2. Deconstruct the .NET Queue Class
    • Re-implement the sample with custom class
    • Examine the ExampleQueue code
    3. Using Thread-Safe Code with Standard Collections
    • Rewrite the code to support thread locks
    • Use a lock statement and mutex to make thread-safe
    • Why locking is not a good solution
    • How the concurrent collections are better
    4. Overview of Thread-Safe Collections
    • Compare standard and concurrent collections
    • Categories of collections
    5. Work with the ConcurrentDictionary Class
    • Create a dictionary
    • Use TryAdd to add an item
    • Use TryRemove to remove an item
    • The GetOrAdd method to get or add an item
    6. Updating Data in ConcurrentDictionary
    • Review the updated example application
    • Potential problems with updating an item
    • Use TryUpdate to update dictionary value
    • Use a while loop with TryUpdate
    • Use the AddOrUpdate method
    • Why ICollection and other interfaces are not thread-safe
    • Inspect your APIs for ICollection usage
    7. Work with the Producer-Consumer Collections
    • Overview of the producer-consumer collections
    • Work with ConcurrentQueue
    • Work with the ConcurrentStack
    • Work with the ConcurrentBag
    8. Using the BlockingCollection
    • Understand the BlockingCollection
    • Use the BlockingCollection with ConcurrentQueue
    • Use the CompleteAdding method
    • Use other collections with BlockingCollection
    • Read items with multiple consumers
    • Create items with multiple producers
    Continuing Your Journey
    • Next steps