.NET Community Toolkit features
The .NET Community Toolkit can be leveraged by all .NET developers. In Chapter 3, MVVM for Maintainability and Testability, we used the MVVM Toolkit, which is part of the .NET Community Toolkit. There are several other features of this toolkit, primarily targeting performance and diagnostics.
The CommunityToolkit.Diagnostics package is available for .NET developers or those frameworks that implement .NET Standard 2.0 or later. It includes two helper libraries, Guard
and ThrowHelper
.
Guard
APIs are used to validate the arguments passed into your .NET methods. They are created to be fast, with minimal impact on the performance of your applications. Here are a few examples of their use:
public void TestData(decimal[] numbers, int size, string data) { Guard.IsNotNull(numbers); Guard.IsInRangeFor(size, numbers); Guard.IsNotNullOrWhitespace(data); }
You can view a complete set...