The .NET Community Toolkit 8.0 | CodeGuru

The .NET Community Toolkit 8.0

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? The .NET Community Toolkit (which was originally part of the Windows Community Toolkit) is simply a collection of APIs […]

Written By
Hannes DuPreez
Hannes DuPreez
Aug 23, 2022
3 minute read
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

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.
Advertisement

CommunityToolkit.Common

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

CommunityToolkit.Diagnostics

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

Guard

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.
Advertisement

CommunityToolkit.Mvvm

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

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).

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.