Пример #1
0
 public static T Invoke <T>(T arg1, T arg2)
 {
     if (typeof(Int32) == typeof(T))
     {
         return((T)(object)checked ((Int32)(object)arg1 + (Int32)(object)arg2));
     }
     if (typeof(Int64) == typeof(T))
     {
         return((T)(object)checked ((Int64)(object)arg1 + (Int64)(object)arg2));
     }
     if (typeof(UInt32) == typeof(T))
     {
         return((T)(object)checked ((UInt32)(object)arg1 + (UInt32)(object)arg2));
     }
     if (typeof(UInt64) == typeof(T))
     {
         return((T)(object)checked ((UInt64)(object)arg1 + (UInt64)(object)arg2));
     }
     if (typeof(Int16) == typeof(T))
     {
         return((T)(object)checked ((Int16) unchecked ((Int16)(object)arg1 + (Int16)(object)arg2)));
     }
     if (typeof(UInt16) == typeof(T))
     {
         return((T)(object)checked ((UInt16) unchecked ((UInt16)(object)arg1 + (UInt16)(object)arg2)));
     }
     if (typeof(Byte) == typeof(T))
     {
         return((T)(object)checked ((Byte) unchecked ((Byte)(object)arg1 + (Byte)(object)arg2)));
     }
     if (typeof(SByte) == typeof(T))
     {
         return((T)(object)checked ((SByte) unchecked ((SByte)(object)arg1 + (SByte)(object)arg2)));
     }
     if (typeof(IntPtr) == typeof(T))
     {
         return((T)(object)CilVerifiable.Add((IntPtr)(object)arg1, (IntPtr)(object)arg2));
     }
     if (typeof(UIntPtr) == typeof(T))
     {
         return((T)(object)CilVerifiable.Add((UIntPtr)(object)arg1, (UIntPtr)(object)arg2));
     }
     if (typeof(Int128) == typeof(T))
     {
         return((T)(object)Int128.Add((Int128)(object)arg1, (Int128)(object)arg2));
     }
     if (typeof(UInt128) == typeof(T))
     {
         return((T)(object)UInt128.Add((UInt128)(object)arg1, (UInt128)(object)arg2));
     }
     if (typeof(Double) == typeof(T))
     {
         return((T)(object)((Double)(object)arg1 + (Double)(object)arg2));
     }
     if (typeof(Single) == typeof(T))
     {
         return((T)(object)(Single)((Single)(object)arg1 + (Single)(object)arg2));
     }
     if (typeof(Quadruple) == typeof(T))
     {
         return((T)(object)((Quadruple)(object)arg1 + (Quadruple)(object)arg2));
     }
     return(StandardFunctor <T>().Invoke(arg1, arg2));
 }
Пример #2
0
 public static Int128 Invoke(Int128 arg1, Int128 arg2)
 {
     return(Int128.Add(arg1, arg2));
 }