Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public struct Maybe<T> : IEquatable<Maybe<T>> {
- private T value;
- private bool has_value;
- private static bool _isnullable = typeof(T).IsNullable();
- public Maybe (T value)
- {
- if (value == null)
- {
- if (!_isnullable)
- {
- throw new ArgumentNullException("value");
- }
- }
- this.value = value;
- has_value = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement