The .NET Community Toolkit 8.0

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

In this programming tutorial, we take a look at the .NET Community Toolkit version 8, its new features, and updates to the developer tool.

Read: Productivity Tools for .NET Developers

What is the .NET Community Toolkit?

.NET Community Toolkit 8

The .NET Community Toolkit (which was originally part of the Windows Community Toolkit) is simply a collection of APIs and other helpers. The Toolkit forms part of the .NET foundation and is system and platform agnostic. These libraries multi-target from .NET Standard 2.0 to .NET 6.

The .NET Community Toolkit is available on GitHub and includes every library in the Toolkit. These libraries include:

  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.Mvvm


CommunityToolkit.HighPerformance contains helpers that allow developers to work more efficiently with high-performance code. It also includes the following APIs:

  • Pooled buffer helpers: These represent a pool of memory blocks.
  • String pool type: The StringPool type implements a configurable pool for string instances to minimize memory allocation when multiple char or byte string instances are created.
  • 2D variant of Memory<T> – Memory2D<T>: Memory2D<T> contains the same functionality as the Memory type, and can be used to represent 2D memory locations.
  • 2D variant of <Span<T> – Span2D<T>: Span2D<T> contains the same functionality as the <Span<T> type, but it supports 2D memory regions.


CommunityToolkit.Common contains helper APIs that are shared with other libraries in the Community Toolkit. These include the following:


CommunityToolkit.Diagnostics contains helper APIs that deal with more efficient argument validation and error checking. Some APIs include:


Guard validates method arguments smoothly, thus, making it faster, less verbose, less error-prone, and more expressive, saving developers from writing checks and throwing exceptions manually.

The Guard APIs are based on the following three principles:

  • Speed: The methods in Guard APIs are generated by making use of T4 templates. As per my book on Visual Studio 2019: “A T4 text template or pre-processed template is a combination of text blocks and control logic that can generate a text file. The logic is written as fragments of program code.”

    There are two types of pre-processed text templates: Design Time (Design-time T4 text templates generate program code in a Visual Studio project) and Runtime (we can generate text strings in our applications during runtime using runtime T4 text templates.)

  • Being intuitive: All Guard APIs have simple self-explanatory names that make them easy to identify and deduce their purposes.
  • Helpfulness: Guard APIs supply detailed exception messages. For more information on Guard APIs have a look at their official documentation.
  • ThrowHelper: As its name implies, the ThrowHelper class helps to efficiently throw exceptions. This class is best used in conjunction with the Guard APIs, especially if programmers want detailed control of the exceptions being thrown.


The MVVM is built around the following principles, according to Microsoft:

  • Platform and Runtime Independent: .NET Standard 2.0 and .NET 5 (UI Framework Agnostic)
  • Simple to pick up and use: No strict requirements on Application structure or coding-paradigms (outside of ‘MVVM’ness); i.e., flexible usage.
  • À la carte: Freedom to choose which components to use.
  • Reference Implementation: Lean and performant, providing implementations for interfaces that are included in the Base Class Library, but lack concrete types to use them directly.

For more information on Microsoft.Toolkit.Mvvm, read its official documentation.

Read more .NET developer tool tutorials, news, and reviews.

Hannes DuPreez
Hannes DuPreez
Ockert J. du Preez is a passionate coder and always willing to learn. He has written hundreds of developer articles over the years detailing his programming quests and adventures. He has written the following books: Visual Studio 2019 In-Depth (BpB Publications) JavaScript for Gurus (BpB Publications) He was the Technical Editor for Professional C++, 5th Edition (Wiley) He was a Microsoft Most Valuable Professional for .NET (2008–2017).

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read