Ejemplo n.º 1
0
 /// <summary>
 /// Converts an integral representation into an enum value or indicates that it cannot.
 /// </summary>
 /// <param name="value">The integral representation to convert.</param>
 /// <param name="policy">Indicates whether invalid integral values should be returned in enum form or should be an error.</param>
 /// <param name="result">The enum value to initialize based on the casting rules.</param>
 /// <returns>true if the enum value is successfully casted, false otherwise.</returns>
 /// <exception cref="System.ArgumentException">
 ///     <paramref name="value"/> exceeds the bounds of the underlying type.
 ///     <paramref name="policy"/> contains a value not defined by the enum.
 ///</exception>
 public static bool TryCast <TValue>(ulong value, InvalidEnumPolicy policy, out TValue result) where TValue : struct, IComparable
 {
     return(EnumExt <TValue> .TryCast(value, policy, out result));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts an integral representation into an enum value or indicates that it cannot.
 /// </summary>
 /// <param name="value">The integral representation to convert.</param>
 /// <param name="result">The enum value to initialize based on the casting rules.</param>
 /// <returns>true if the enum value is successfully casted, false otherwise.</returns>
 /// <exception cref="System.ArgumentException"><paramref name="value"/> exceeds the bounds of the underlying type.</exception>
 public static bool TryCast <TValue>(uint value, out TValue result) where TValue : struct, IComparable
 {
     return(EnumExt <TValue> .TryCast(value, out result));
 }