public static string GetMessage(VectorOperationType vectorType) { switch (vectorType) { case VectorOperationType.Addition: return("The two vectors could not be added because their dimensions were unequal."); case VectorOperationType.Dimension: return("Two vectors with unequal dimension cannot be compared."); case VectorOperationType.Division: return("Division by a scalar is only supported if the scalar is invertible."); case VectorOperationType.Inner: return("The inner product cannot be taken of vectors with unequal dimensions."); case VectorOperationType.MatrixVector: return("The matrix-vector product couldn't be computed."); case VectorOperationType.Outer: return(""); } throw new ArgumentException("The given VectorOperationType was " + "not a valid object."); }
public IncompatibleOperationException(VectorOperationType type, string message) : base(message) { VectorType = type; }
public IncompatibleOperationException(VectorOperationType type) : base(GetMessage(type)) { VectorType = type; }