ProductivityExtensionMethods 1.0.0-beta.6

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.6
NuGet\Install-Package ProductivityExtensionMethods -Version 1.0.0-beta.6
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.6" />
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.6
#r "nuget: ProductivityExtensionMethods, 1.0.0-beta.6"
#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.6&prerelease

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

How to use

After referencing the package, a T4 Template file is created in your project that will generate a C# .cs file. Modify top section of the file to enable certain category of extension methods. Nuget will take care of future updates. Ignore the generated file in your source control.

Visit FAQ page for more details.

Important Notes

  • The generated class is in C#, so it only works in C# projects.
  • The C# code contains C# 7.3 syntax in some categories. Make sure it is enabled in your project by going to Project Properties → Build → Advanced...
  • The C# code contains Nullable Reference Type feature available in C# 8. It will only be generated if target framework is .Net Core 3.0 or .Net Standard 2.1.
  • This package is tested on latest versions of Visual Studio 2019/2017.

Known Issues

  • If the nuget package is removed for any reason then immediately added back, no .tt file will be added to the project. This is a bug in Visual Studio/Nuget. The initialization script for the nuget package is not run the second time until Visual Studio is restarted.
  • If package is added to one project, then immediately to another, the second project doesn't get the .tt file. This is due to the same bug as above and VS should be restarted between adds.
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 625 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

- No more dedicated category for ToHierarchy() extension method. Moved to IEnumerable extensions.
- Null reference will be enabled now if target framework is .Net Standard 2.1 compatible (and above). Before it was based on visual studio version which was wrong since at some point C# lang version became dependent on target framework.
- Added a range of DateTime extensions to obtain dates relative to the date passed in. GetNext,GetPrevious, GetFirst and GetLast
- Added SetDate extension on DateTime to change year, month or day.
- Added SetTime extension on TimeSpan to change portion of timespan, such as only the seconds.
- Added ValueOrDefault on string, to supply a default value for a string if the variable is blank. Example: fullName.ValueOrDefault("John Doe");
- Added Contains method on arrays, which is a faster overload than stock Enumerable.Contains.
- Changed the signature of SetTime on the date time, so there is only one overload now that can be used to change specific time aspects of a date using named parameters. Other overloads were removed.
- Fixed the issue of leftover nullable reference syntax in conditional compilation regions of code.
- Performance improvements on some methods when the actual instance passed in is an array or generic List rather than generic IEnumerable.