ProductivityExtensionMethods 1.0.0-beta.4

This is a prerelease version of ProductivityExtensionMethods.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package ProductivityExtensionMethods --version 1.0.0-beta.4
NuGet\Install-Package ProductivityExtensionMethods -Version 1.0.0-beta.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ProductivityExtensionMethods" Version="1.0.0-beta.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ProductivityExtensionMethods --version 1.0.0-beta.4
#r "nuget: ProductivityExtensionMethods, 1.0.0-beta.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ProductivityExtensionMethods as a Cake Addin
#addin nuget:?package=ProductivityExtensionMethods&version=1.0.0-beta.4&prerelease

// Install ProductivityExtensionMethods as a Cake Tool
#tool nuget:?package=ProductivityExtensionMethods&version=1.0.0-beta.4&prerelease

Currently only for C# language.

How to use

After Referencing the package, it should create a T4 Template file in your project that will generate a C# .cs file. Modify top section of the file to enable certain category of extension methods.

How is it different from other Extension Method DLLs?

This is NOT a DLL assembly!

DLLs are not good, because:

  • A DLL that only contains extension methods, in essence a series of so-called "utility" or "helper" functions, is not a good design approach. It's just ugly, and I'm sure I don't need to explain more.
  • It is an extra totally unnecessary addition to the deployment, especially if you need to deal with strong names and/or signing the assembly. This is especially not justified when you did not use the extension methods extensively.
  • Referencing such DLL adds in hundreds of extension methods that pollute your IntelliSense. No way to choose only what you need on a project-level basis.
  • You need to add a reference in all your projects in the solution to have it available everywhere. Bad practice, on so many levels.
  • You may need to add an extra using statement in ALL your code files to make them available everywhere.

How ProductivityExtensionMethods tackles the problem?

  • Referencing nuget package only adds one T4 Template file to your project.
  • The T4 template generates a C# code file (.cs) in that project. It is a single partial static class, under the default namespace of the assembly.
  • You add the nuget package to the project that is referenced by all your other projects. The methods are now available everywhere!
  • The top section of the T4 template file has a configuration that you can use to switch on only the set of the methods that you need.
  • When new version of this package arrives, you just update the package. It automatically takes care of porting your configuration to the new version.
  • It automatically picks up whether or not nullable reference types are enabled in your project and uses that feature as necessary.

Important Notes

  • The generated class is in C#, so it only works in C# projects.
  • The C# code contains C#8 syntax for some categories.
  • This package is only tested for .net standard project in Visual Studio 16.3 though the implementation should work on other project types as well.

Known Issues

  • The nullable reference type does not get automatically disabled for IsAClosedTypeOf and TryMakeGenericType methods. This will be fixed in next release. To bypass, modify the T4 template file and remove the question marks if your project doesn't compile.
  • If you reference the package but don't see any items added to your project, make sure the project was saved in the first place. This is a bug that will be fixed in a future versions.
  • If you removed the package for any reason, and immediately added the package again, no file will be added to the project. This is a bug in Visual Studio/Nuget that when you remove and immediately add again, the initialization script for the nuget package is not called. (Observed in Visual Studio 2019 16.3)
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta.7 623 2/21/2020
1.0.0-beta.6 251 12/8/2019
1.0.0-beta.5 274 11/24/2019
1.0.0-beta.4 280 10/11/2019
1.0.0-beta.3 368 10/11/2019
1.0.0-beta.2 371 10/9/2019
1.0.0-beta.1 379 10/8/2019

In version 1.0.0-beta.4, Many issues have been fixed with visual studio nuget integration.
If currently referencing any version below, uninstall the package, restart visual studio, and install the latest package.