Exemple #1
0
 public static T1 Max <T1>(this Tuple4 <T1, T1, T1, T1> t) where T1 : IComparable <T1>
 {
     if (t.first.CompareTo(t.second) > 0)
     {
         if (t.first.CompareTo(t.third) > 0)
         {
             if (t.first.CompareTo(t.fourth) > 0)
             {
                 return(t.first);
             }
             else
             {
                 return(t.fourth);
             }
         }
         else
         if (t.third.CompareTo(t.fourth) > 0)
         {
             return(t.third);
         }
         else
         {
             return(t.fourth);
         }
     }
     else if (t.second.CompareTo(t.third) > 0)
     {
         if (t.second.CompareTo(t.fourth) > 0)
         {
             return(t.second);
         }
         else
         {
             return(t.fourth);
         }
     }
     else if (t.third.CompareTo(t.fourth) > 0)
     {
         return(t.third);
     }
     else
     {
         return(t.fourth);
     }
 }
Exemple #2
0
        public static bool operator ==(Tuple4 <T1, T2, T3, T4> a, Tuple4 <T1, T2, T3, T4> b)
        {
            if (Tuple4 <T1, T2, T3, T4> .IsNull(a) && !Tuple4 <T1, T2, T3, T4> .IsNull(b))
            {
                return(false);
            }

            if (!Tuple4 <T1, T2, T3, T4> .IsNull(a) && Tuple4 <T1, T2, T3, T4> .IsNull(b))
            {
                return(false);
            }

            if (Tuple4 <T1, T2, T3, T4> .IsNull(a) && Tuple4 <T1, T2, T3, T4> .IsNull(b))
            {
                return(true);
            }

            return
                (a.first.Equals(b.first) &&
                 a.second.Equals(b.second) &&
                 a.third.Equals(b.third) &&
                 a.fourth.Equals(b.fourth));
        }