https://github.com/matteckert/enumcollections
Port of Java's EnumSet collection to C#
https://github.com/matteckert/enumcollections
c-sharp enums enumset nunit
Last synced: 7 months ago
JSON representation
Port of Java's EnumSet collection to C#
- Host: GitHub
- URL: https://github.com/matteckert/enumcollections
- Owner: matteckert
- License: apache-2.0
- Created: 2013-05-07T15:28:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-03-01T07:32:13.000Z (almost 7 years ago)
- Last Synced: 2025-06-24T22:02:19.293Z (7 months ago)
- Topics: c-sharp, enums, enumset, nunit
- Language: C#
- Homepage:
- Size: 54.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
 EnumCollections
===============
Port of Java's EnumSet collection to C#
-----------------------------------
### EnumSet
#### Overview
- Performance characteristics are similar to the [Java's EnumSet](http://docs.oracle.com/javase/7/docs/api/java/util/EnumSet.html).
- 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:
```csharp
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)));
```
1. When creating an empty `EnumSet`, you must specify the type:
```csharp
var a = EnumSet.Of()
```