mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
Merge remote-tracking branch 'origin/enumtoushort' into dev
# Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
- Added Yield extension to return a single-item enumerable for an object.
|
- Added Yield extension to return a single-item enumerable for an object.
|
||||||
- Added util method for removing BOM characters from UTF8 data
|
- Added util method for removing BOM characters from UTF8 data
|
||||||
|
- Added extension method to convert from bool to ushort and back
|
||||||
|
- Added extension method to cast enums to ushort value
|
||||||
|
|
||||||
## [3.0.0] - 2018-04-23
|
## [3.0.0] - 2018-04-23
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -52,5 +52,13 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
int num = (int)(object)value;
|
int num = (int)(object)value;
|
||||||
return ((int)(object)extends & num) == num;
|
return ((int)(object)extends & num) == num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ushort ToUShort(this Enum extends)
|
||||||
|
{
|
||||||
|
if (extends == null)
|
||||||
|
throw new ArgumentNullException("extends");
|
||||||
|
|
||||||
|
return (ushort)(object)extends;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user