Advertisement
stefanpu

Check if is number type

Mar 3rd, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1.         internal static Matrix<T> PefrormArithmetic(Matrix<T> first, Matrix<T> second)
  2.         {
  3.             Type matrixType = typeof(T);
  4.  
  5.             if (NumbersTypes.IsNumberType(matrixType))
  6.             {
  7.  
  8.                 return MultiplyMatrices(first, second);
  9.             }
  10.             else
  11.             {
  12.                 string unsupportedTypeMessage = "The matrixes do not consist of numbers.";
  13.                 throw new ArgumentException(unsupportedTypeMessage);
  14.             }
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement