|Microsoft Launches .NET Community Toolkit
|Tuesday, 09 August 2022
Microsoft has officially launched the .NET Community Toolkit, a collection of helpers and APIs that work for all .NET developers. The toolkit is part of the .NET Foundation and is maintained and published by Microsoft which says the toolkit is agnostic of any specific UI platform.
This isn't a completely new launch; all the libraries of the .NET Community Toolkit were originally part of the Windows Community Toolkit. That is a collection of helpers, extensions, and custom controls designed to simplify building UWP and .NET apps for Windows 10 and Windows 11.
The APIs in the toolkit originally were aimed at Windows development, but over time an increasing number are aimed just at .NET in general rather than having Windows-specific dependencies, so the new toolkit consists of those Windows-agnostic APIs put together for .NET developers not doing any Windows development.
One of the main components of the .NET Community Toolkit is the MVVM Toolkit, which Microsoft describes as a modern, fast, platform agnostic and modular MVVM library that is used by the Microsoft Store and the Photos app. It is described as "inspired by MvvmLight" and is also the official replacement for it now that the library has been deprecated.
The MVVM Toolkit in this release includes new MVVM source generators, which are meant to greatly reduce the boilerplate code thatâ€™s needed to set up an application using MVVM. Source Generators let C# developers inspect user code as it is being compiled. The generator can create new C# source files on the fly that are added to the user's compilation. In this way, you have code that runs during compilation. It inspects your program to produce additional source files that are compiled together with the rest of your code.
This image shows the source generator attributes in action. On the left-hand side is the original hand-written example using the MVVM Toolkit. The right-hand side shows using the new attributes to automatically generate the exact same code.
.NET Community Toolkit is available now on GitHub.
or email your comment to: email@example.com