EnumCollections 2.0.3

Port of Java's EnumSet

Install-Package EnumCollections -Version 2.0.3
dotnet add package EnumCollections --version 2.0.3
<PackageReference Include="EnumCollections" Version="2.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EnumCollections --version 2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

EnumCollections

Port of Java's EnumSet collection to C#

EnumSet

Overview
  • Performance characteristics are similar to the Java's EnumSet.
  • More efficient with Enum types that have less than or equal to 64 values.
  • Static factory methods similar to the Java version are provided: EnumSet.Of(Bird.Stork, ...)
Notes
  1. Enum constants defined with the same value are treated as aliases:

    public enum Bird { 
        BlueJay,        // 0
        Stork,          // 1
        Puffin,         // 2
        SeaParrot = 2,  // 2
        Chicken         // 3
    }
    
    var a = EnumSet.Of(Bird.SeaParrot);
    var b = EnumSet.Of(Bird.Puffin)
    Assert.That(a, Is.EqualTo(b)));
    
  2. When creating an empty EnumSet, you must specify the type:

    var a = EnumSet.Of<Bird>()
    

EnumCollections

Port of Java's EnumSet collection to C#

EnumSet

Overview
  • Performance characteristics are similar to the Java's EnumSet.
  • More efficient with Enum types that have less than or equal to 64 values.
  • Static factory methods similar to the Java version are provided: EnumSet.Of(Bird.Stork, ...)
Notes
  1. Enum constants defined with the same value are treated as aliases:

    public enum Bird { 
        BlueJay,        // 0
        Stork,          // 1
        Puffin,         // 2
        SeaParrot = 2,  // 2
        Chicken         // 3
    }
    
    var a = EnumSet.Of(Bird.SeaParrot);
    var b = EnumSet.Of(Bird.Puffin)
    Assert.That(a, Is.EqualTo(b)));
    
  2. When creating an empty EnumSet, you must specify the type:

    var a = EnumSet.Of<Bird>()
    

Release Notes

First release

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.3 457 2/13/2018