Extensions for System.Enum.
More...
|
static T | Include< T > (this Enum value, T append) |
| Includes an enumerated type and returns the new value. More...
|
|
static T | Remove< T > (this Enum value, T remove) |
| Removes an enumerated type and returns the new value. More...
|
|
static bool | Has< T > (this Enum value, T check) |
| Checks if an enumerated type contains a value. More...
|
|
static bool | Missing< T > (this Enum obj, T value) |
| Checks if an enumerated type is missing a value. More...
|
|
Extensions for System.Enum.
static bool TriDevs.TriEngine.Extensions.EnumerationExtensions.Has< T > |
( |
this Enum |
value, |
|
|
T |
check |
|
) |
| |
|
static |
Checks if an enumerated type contains a value.
- Template Parameters
-
- Parameters
-
value | The enum to check. |
check | Value to check for. |
- Returns
- True if the enum has the value(s), false otherwise.
149 Type type = value.GetType();
152 var parsed =
new _Value(check, type);
153 if (parsed.Signed.HasValue)
155 return (Convert.ToInt64(value) & (long)parsed.Signed) == (long)parsed.Signed;
157 if (parsed.Unsigned.HasValue)
159 return (Convert.ToUInt64(value) & (ulong)parsed.Unsigned) == (ulong)parsed.Unsigned;
static T TriDevs.TriEngine.Extensions.EnumerationExtensions.Include< T > |
( |
this Enum |
value, |
|
|
T |
append |
|
) |
| |
|
static |
Includes an enumerated type and returns the new value.
- Template Parameters
-
- Parameters
-
value | The enum to append to. |
append | Value to append. |
- Returns
- New enum T with the new values.
95 var type = value.GetType();
98 object result = value;
99 var parsed =
new _Value(append, type);
100 if (parsed.Signed.HasValue)
102 result = Convert.ToInt64(value) | (long)parsed.Signed;
104 else if (parsed.Unsigned.HasValue)
106 result = Convert.ToUInt64(value) | (ulong)parsed.Unsigned;
110 return (T)Enum.Parse(type, result.ToString());
static bool TriDevs.TriEngine.Extensions.EnumerationExtensions.Missing< T > |
( |
this Enum |
obj, |
|
|
T |
value |
|
) |
| |
|
static |
Checks if an enumerated type is missing a value.
- Template Parameters
-
- Parameters
-
obj | The enum to check. |
value | Value to check for. |
- Returns
- True if the enum is missing the value(s), false otherwise.
173 return !Has(obj, value);
static T TriDevs.TriEngine.Extensions.EnumerationExtensions.Remove< T > |
( |
this Enum |
value, |
|
|
T |
remove |
|
) |
| |
|
static |
Removes an enumerated type and returns the new value.
- Template Parameters
-
- Parameters
-
value | The enum to remove from. |
remove | Value to remove. |
- Returns
- New enum T with the value(s) removed.
122 Type type = value.GetType();
125 object result = value;
126 var parsed =
new _Value(
remove, type);
127 if (parsed.Signed.HasValue)
129 result = Convert.ToInt64(value) & ~(long)parsed.Signed;
131 else if (parsed.Unsigned.HasValue)
133 result = Convert.ToUInt64(value) & ~(ulong)parsed.Unsigned;
137 return (T)Enum.Parse(type, result.ToString());
The documentation for this class was generated from the following file: