Ejemplo n.º 1
0
 private static bool Equals(NullableOf <T> left, NullableOf <T> right)
 {
     return
         (left.HasValue != right.HasValue ? false :
          !left.HasValue ? true :
          EqualityComparer <T> .Default.Equals(left.value, right.value));
 }
Ejemplo n.º 2
0
        public static Nullable <TResult> SelectMany <T, TMid, TResult>(this NullableOf <T> @this, Func <T, Nullable <TMid> > midSelector, Func <T, TMid, TResult> resultSelector, RequireStruct <TResult> _ = default(RequireStruct <TResult>))
            where T : class
            where TMid : struct
            where TResult : struct
        {
            if ([email protected])
            {
                return(default(Nullable <TResult>));
            }
            var mid = midSelector((T)@this);

            if (!mid.HasValue)
            {
                return(default(Nullable <TResult>));
            }
            return(resultSelector((T)@this, (TMid)mid));
        }
Ejemplo n.º 3
0
 public bool Equals(NullableOf <T> that)
 {
     return(Equals(this, that));
 }
Ejemplo n.º 4
0
 public static Nullable <TResult> Select <T, TResult>(this NullableOf <T> @this, Func <T, TResult> func, RequireStruct <TResult> _ = default(RequireStruct <TResult>))
     where T : class
     where TResult : struct
 {
     return(@this.HasValue ? func((T)@this) : default(Nullable <TResult>));
 }