Ejemplo n.º 1
0
 /// <summary>
 /// Converts a uint to a specified enumeration <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">Enumeration Type</typeparam>
 /// <param name="value">value to convert</param>
 /// <returns><paramref name="value"/> as the enumeration type</returns>
 public static T FromUInt32 <T>(uint value) where T : struct, E
 => EnumCompiledCache <T> .FromUInt32(value);
Ejemplo n.º 2
0
 /// <summary>
 /// Converts a ulong to a specified enumeration <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">Enumeration Type</typeparam>
 /// <param name="value">value to convert</param>
 /// <returns><paramref name="value"/> as the enumeration type</returns>
 public static T FromUInt64 <T>(ulong value) where T : struct, E
 => EnumCompiledCache <T> .FromUInt64(value);
Ejemplo n.º 3
0
 /// <summary>
 /// Bitwise Exclusive OR
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="left">An enumeration value</param>
 /// <param name="right">An enumeration value</param>
 /// <returns><c>left ^ right</c></returns>
 public static T BitwiseExclusiveOr <T>(T left, T right) where T : struct, E
 => EnumCompiledCache <T> .BitwiseExclusiveOr(left, right);
Ejemplo n.º 4
0
 /// <summary>
 /// Converts a ushort to a specified enumeration <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">Enumeration Type</typeparam>
 /// <param name="value">value to convert</param>
 /// <returns><paramref name="value"/> as the enumeration type</returns>
 public static T FromUInt16 <T>(ushort value) where T : struct, E
 => EnumCompiledCache <T> .FromUInt16(value);
Ejemplo n.º 5
0
 /// <summary>
 /// Converts the value of the specified enumeration to an unsigned int.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>A 32-bit unsigned integer that is cast equivalent to the enumeration value</returns>
 public static uint ToUInt32 <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .ToUInt32(value);
Ejemplo n.º 6
0
 /// <summary>
 /// Converts the value of the specified enumeration to a float.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>A single precision floating point number that is case equivalent to the enumeration value</returns>
 public static float ToSingle <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .ToSingle(value);
Ejemplo n.º 7
0
 /// <summary>
 /// Returns an indication whether a constant with a specified value exists in a specified
 /// enumeration.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>
 ///     <c>true</c> if <paramref name="value"/> is valid for <typeparamref name="T"/>.
 /// </returns>
 public static bool IsDefined <T>(int value) where T : struct, E
 => EnumCompiledCache <T> .IsDefinedInt32(value);
Ejemplo n.º 8
0
 /// <summary>
 /// Converts the value of the specified enumeration to a signed byte.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>An 8-bit unsigned integer that is cast equivalent to the enumeration value</returns>
 public static sbyte ToSByte <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .ToSByte(value);
Ejemplo n.º 9
0
 /// <summary>
 /// Returns an indication whether a constant with a specified value exists in a specified
 /// enumeration.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>
 ///     <c>true</c> if <paramref name="value"/> is valid for <typeparamref name="T"/>.
 /// </returns>
 public static bool IsDefined <T>(byte value) where T : struct, E
 => EnumCompiledCache <T> .IsDefinedByte(value);
Ejemplo n.º 10
0
 /// <summary>
 /// Returns an indication whether a constant with a specified value exists in a specified
 /// enumeration.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>
 ///     <c>true</c> if <paramref name="value"/> is valid for <typeparamref name="T"/>.
 /// </returns>
 public static bool IsDefined <T>(ushort value) where T : struct, E
 => EnumCompiledCache <T> .IsDefinedUInt16(value);
Ejemplo n.º 11
0
 /// <summary>
 /// Returns the result of bitwise and for value and bitwise not of the flag.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <param name="flag">An enumeration value</param>
 /// <returns>Value with the specified flag unset</returns>
 public static T UnsetFlag <T>(T value, T flag) where T : struct, E
 => EnumCompiledCache <T> .UnsetFlag(value, flag);
Ejemplo n.º 12
0
 /// <summary>
 /// Checks whether a flag exists.
 /// This function does not check for <c>FlagsAttribute</c>.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <param name="flag">An enumeration value</param>
 /// <returns>
 /// true if the bit field or bit fields that are set in flag are also set in the current instance; otherwise, false.
 /// </returns>
 public static bool HasFlag <T>(T value, T flag) where T : struct, E
 => EnumCompiledCache <T> .HasFlag(value, flag);
Ejemplo n.º 13
0
 /// <summary>
 /// Bitwise NOT
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns><c>~value</c></returns>
 public static T BitwiseNot <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .BitwiseNot(value);
Ejemplo n.º 14
0
 /// <summary>
 /// Converts a float to a specified enumeration <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">Enumeration Type</typeparam>
 /// <param name="value">value to convert</param>
 /// <returns><paramref name="value"/> as the enumeration type</returns>
 public static T FromSingle <T>(float value) where T : struct, E
 => EnumCompiledCache <T> .FromSingle(value);
Ejemplo n.º 15
0
 /// <summary>
 /// Returns an indication whether a constant with a specified value exists in a specified
 /// enumeration.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>
 ///     <c>true</c> if <paramref name="value"/> is valid for <typeparamref name="T"/>.
 /// </returns>
 public static bool IsDefined <T>(ulong value) where T : struct, E
 => EnumCompiledCache <T> .IsDefinedUInt64(value);
Ejemplo n.º 16
0
 /// <summary>
 /// Converts a double to a specified enumeration <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">Enumeration Type</typeparam>
 /// <param name="value">value to convert</param>
 /// <returns><paramref name="value"/> as the enumeration type</returns>
 public static T FromDouble <T>(double value) where T : struct, E
 => EnumCompiledCache <T> .FromDouble(value);
Ejemplo n.º 17
0
 /// <summary>
 /// Returns an idication whether a constant with a specified value exists in a specified
 /// enumeration
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>
 ///     <c>true</c> if <paramref name="value"/> is valid for <typeparamref name="T"/>.
 /// </returns>
 public static bool IsDefined <T>(float value) where T : struct, E
 => EnumCompiledCache <T> .IsDefinedSingle(value);
Ejemplo n.º 18
0
 /// <summary>
 /// Converts the value of the specified enumeration to an unsigned short.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>A 16-bit unsigned integer that is cast equivalent to the enumeration value</returns>
 public static ushort ToUInt16 <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .ToUInt16(value);
Ejemplo n.º 19
0
 /// <summary>
 /// Returns an idication whether a constant with a specified value exists in a specified
 /// enumeration
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>
 ///     <c>true</c> if <paramref name="value"/> is valid for <typeparamref name="T"/>.
 /// </returns>
 public static bool IsDefined <T>(double value) where T : struct, E
 => EnumCompiledCache <T> .IsDefinedDouble(value);
Ejemplo n.º 20
0
 /// <summary>
 /// Converts the value of the specified enumeration to an unsigned long.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>A 64-bit unsigned integer that is cast equivalent to the enumeration value</returns>
 public static ulong ToUInt64 <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .ToUInt64(value);
Ejemplo n.º 21
0
 /// <summary>
 /// Converts a sbyte to a specified enumeration <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">Enumeration Type</typeparam>
 /// <param name="value">value to convert</param>
 /// <returns><paramref name="value"/> as the enumeration type</returns>
 public static T FromSByte <T>(sbyte value) where T : struct, E
 => EnumCompiledCache <T> .FromSByte(value);
Ejemplo n.º 22
0
 /// <summary>
 /// Converts the value of the specified enumeration to a double.
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="value">An enumeration value</param>
 /// <returns>A double precision floating point number that is case equivalent to the enumeration value</returns>
 public static double ToDouble <T>(T value) where T : struct, E
 => EnumCompiledCache <T> .ToDouble(value);
Ejemplo n.º 23
0
 /// <summary>
 /// Bitwise AND
 /// </summary>
 /// <typeparam name="T">An enumeration type</typeparam>
 /// <param name="left">An enumeration value</param>
 /// <param name="right">An enumeration value</param>
 /// <returns><c>left &amp; right</c></returns>
 public static T BitwiseAnd <T>(T left, T right) where T : struct, E
 => EnumCompiledCache <T> .BitwiseAnd(left, right);