.NET Community Toolkit v8.0 Preview Revamps MVVM Library
Microsoft announced the first preview of .NET Community Toolkit v8.0.0, which revamps the MVVM library and introduces a new GitHub repo to host the project.
This .NET Foundation project is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. It's one of a number of similar toolkits, which typically are collections of helper functions, custom controls and app services designed to simplify and demonstrate common developer tasks for projects of varying types. For example, under the guise of the Community Toolkit GitHub repo are kits for Windows, .NET MAUI and more.
The included .NET Community Toolkit resulted from a Microsoft effort to split out its .NET-specific libraries from the existing Windows Community Toolkit into their own dedicated repository. The .NET Community Toolkit contains libraries for MVVM, Diagnostics, High Performance and more.
The project's GitHub release page lists all breaking changes, bug fixes, improvements and new features in Preview 1. The new features and improvements include:
One key component of the .NET kit provides MVVM source generators to augment the MVVM library, and Preview 1 includes a revamped and improved preview of those source generators. They now run faster, feature simplified commands, add new observable properties attributes and include a Viewmodel composition tweak to get around C#'s lack of multiple inheritance support.
"All generators have been rewritten from scratch to be incremental generators, meaning they will run much faster than before and they will help keep the IDE fast and responsive even when working on large scale projects," said Sergio Pedri of the Microsoft Store client team in a Jan. 25 blog post. "These APIs are meant to greatly reduce the necessarily boilerplate when working with MVVM, with helpers ranging from observable properties to commands."
Also, .NET 6 is now supported as a new target across all libraries, which adds these benefits:
- Trimming support is now enabled for all libraries.
The Count<T>() extension in the HighPerformance package now also supports
- Several optimizations have been introduced when on .NET 6.
The new GitHub repo for the project, meanwhile, is where all .NET libraries can be found from now on.
"Libraries in this new toolkit have no dependencies on any specific UI frameworks, so they can be used by all developers regardless of the framework or runtime they choose to work on their projects," Pedri said. "That is, the .NET Community Toolkit can be referenced by applications and libraries targeting .NET, .NET Core, .NET Standard, .NET Framework, WPF, UWP, MAUI, Xamarin, Unity, and more!"
David Ramel is an editor and writer for Converge360.