2,056

Downloads

191

Downloads of v 1.2.3

3

Average downloads per day

2016-07-16

Last published

Share on Social Networks

Proper Generic Enum and Delegate Methods

1.2.3

Enums and Delegates are a fundimental component of .Net, however, as of version 6.0 of the C# language, there's no way to (directly) constrain a generic parameter to System.Enum or System.Delegate. There's so many reasons to want to do so, not the least of which is the set of kludgy static methods on Enum and Delegate that would really benefit from generic implementations.

This package addresses that need. Written in C++/CLI since C# cannot declare an enum or delegate restriction, this library provides a set of well performing extension and static methods off of the "Diagonactic.Enums" class that provide a more readable way of performing common operations on enums and delegates, all of which can be consumed by C# code.

Enum methods are stable, Delegate methods are considered "Beta". As a result, the API for Delegate methods may be modified (Obsolete tags for invalid members will be added if this happens), though every effort will be made to avoid this. Enum methods are API stable, however, methods are added occasionally.

All stable methods are unit tested for all underlying types with complete code coverage.

See release notes and readme.md on the Project site.

Included .dll is compiled IL only in "Any CPU" format.

To install Proper Generic Enum and Delegate Methods, run the following command in the Package Manager Console

Install-Package DiagonacticEnumsExtensions

Release Notes

New in version 1.2.3 - Added constructor to ParameterizedEnumDelegateMap that allows passing in the delegates as a dictionary.
Added multiple parameter versions of ParameteizedEnumDelegatmap.

New in version 1.2.2 - Added ParameterizedEnumDelegateMap which allows passing a parameter into the method since that covers just about every useful use case for that. :o)

New in version 1.2 - Added EnumDelegateMap, allowing execution of code based on enum flags set.

New in version 1.2.2 - Eliminated dependency on JetBrains.Annotations that was causing code contracts to fail.

New in version 1.1.2 - Strong assembly signing.

New in version 1.1.1 - More correct handling of tests against "0" for IsFlagSet/AreAllFlagsSet/AreAnyFlagsSet

New in version 1.1.0 - Exposed the internal IEqualityComparer implementations used to get an IEqualityComparer for any enum type that performs operations without boxing/unboxing.

New in version 1.0.0 - Optimised several methods doubling the speed of some and reducing memory footprint.

New in version 0.0.9.90 - Added EqualsAny - Similar to AreAnyFlagsSet but for non-flag enums.

New in version 0.0.9.70 - Added Predicate overloads to Add/Remove/Modify conditional flags methods.

New in version 0.0.9.60 - Added conditional Add/Remove flags with bool and Func<bool>, allowing add when true and do nothing when false.
Added ModifyFlag with Func<bool> and bool parameter that adds on true and removes on false.

New in version 0.0.9.52 - Removed Readme.md and Icon.ico from package.

Owners

Authors

Matthew S. Dippel

Copyright

Copyright © Matthew S. Dippel (under Apache 2.0)

Tags

Dependencies

  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.5.1

    • No dependencies.
  • .NETFramework 4.5.2

    • No dependencies.

Version History

Version Downloads Last updated
Proper Generic... 1.2.2 72 Friday, July 8, 2016
Proper Generic... 1.2.1 67 Friday, July 8, 2016
Proper Generic... 1.2.0 62 Thursday, July 7, 2016
Proper Generic... 1.1.2.2 70 Monday, July 4, 2016
Proper Generic... 1.1.2.1 168 Tuesday, December 15, 2015
Proper Generic... 1.1.2 89 Wednesday, December 9, 2015
Proper Generic... 1.1.1 79 Tuesday, December 8, 2015
Proper Generic... 1.1.0 97 Friday, December 4, 2015
Proper Generic... 1.0.0 81 Thursday, December 3, 2015
Proper Generic... 0.0.9.95 99 Friday, November 20, 2015
Proper Generic... 0.0.9.90 94 Thursday, November 19, 2015
Proper Generic... 0.0.9.70 113 Sunday, November 8, 2015
Proper Generic... 0.0.9.60 90 Sunday, November 8, 2015
Proper Generic... 0.0.9.52 90 Friday, November 6, 2015
Proper Generic... 0.0.9.51 131 Sunday, November 1, 2015
Proper Generic... 0.0.9.50 91 Sunday, November 1, 2015
Proper Generic... 0.0.9.21 94 Saturday, October 31, 2015
Proper Generic... 0.0.9.20 94 Saturday, October 31, 2015
Proper Generic... 0.0.9.10 89 Friday, October 30, 2015
Proper Generic... 0.0.9 95 Wednesday, October 28, 2015