3 namespace FxSharp.Extensions
5 public static class IntegralTypeExtensions
13 public static Maybe<T> ParseEnum<T>(
this int value)
16 return Enum.IsDefined(typeof (T),
value)
17 ? Maybe.Just((T) (ValueType)
value)
27 public static Maybe<T> ParseEnum<T>(
this uint
value)
30 return Enum.IsDefined(typeof (T),
value)
31 ? Maybe.Just((T) (ValueType)
value)
41 public static Maybe<T> ParseEnum<T>(
this long value)
44 return Enum.IsDefined(typeof (T),
value)
45 ? Maybe.Just((T) (ValueType)
value)
55 public static Maybe<T> ParseEnum<T>(
this ulong
value)
58 return Enum.IsDefined(typeof (T),
value)
59 ? Maybe.Just((T) (ValueType)
value)
69 public static Maybe<T> ParseEnum<T>(
this short value)
72 return Enum.IsDefined(typeof (T),
value)
73 ? Maybe.Just((T) (ValueType)
value)
83 public static Maybe<T> ParseEnum<T>(
this ushort
value)
86 return Enum.IsDefined(typeof (T),
value)
87 ? Maybe.Just((T) (ValueType)
value)
97 public static Maybe<T> ParseEnum<T>(
this byte
value)
100 return Enum.IsDefined(typeof (T),
value)
101 ? Maybe.Just((T) (ValueType)
value)
102 : Maybe.Nothing<T>();
111 public static Maybe<T> ParseEnum<T>(
this sbyte
value)
114 return Enum.IsDefined(typeof (T),
value)
115 ? Maybe.Just((T) (ValueType)
value)
116 : Maybe.Nothing<T>();
Property</c ></item > *< item >< c > value