コード例 #1
0
 public static T InvokeImpl(T arg1, T arg2)
 {
     if (null != default(T))
     {
         if (typeof(Int32) == typeof(T))
         {
             return((T)(object)checked ((Int32)(object)arg1 * (Int32)(object)arg2));
         }
         else if (typeof(Int64) == typeof(T))
         {
             return((T)(object)checked ((Int64)(object)arg1 * (Int64)(object)arg2));
         }
         else if (typeof(UInt32) == typeof(T))
         {
             return((T)(object)checked ((UInt32)(object)arg1 * (UInt32)(object)arg2));
         }
         else if (typeof(UInt64) == typeof(T))
         {
             return((T)(object)checked ((UInt64)(object)arg1 * (UInt64)(object)arg2));
         }
         else if (typeof(Int16) == typeof(T))
         {
             return((T)(object)checked ((Int16) unchecked ((int)(Int16)(object)arg1 * (int)(Int16)(object)arg2)));
         }
         else if (typeof(UInt16) == typeof(T))
         {
             return((T)(object)checked ((UInt16) unchecked ((uint)(UInt16)(object)arg1 * (uint)(UInt16)(object)arg2)));
         }
         else if (typeof(Byte) == typeof(T))
         {
             return((T)(object)checked ((Byte) unchecked ((uint)(Byte)(object)arg1 * (uint)(Byte)(object)arg2)));
         }
         else if (typeof(SByte) == typeof(T))
         {
             return((T)(object)checked ((SByte) unchecked ((int)(SByte)(object)arg1 * (int)(SByte)(object)arg2)));
         }
         else if (typeof(Int128) == typeof(T))
         {
             return((T)(object)(Int128.Multiply((Int128)(object)arg1, (Int128)(object)arg2)));
         }
         else if (typeof(UInt128) == typeof(T))
         {
             return((T)(object)(UInt128.Multiply((UInt128)(object)arg1, (UInt128)(object)arg2)));
         }
     }
     return(InvokeImpl1(arg1, arg2));
 }