/// <summary> /// Multiplication of the specified leftElement and rightElement. /// </summary> /// <param name="leftElement">Left element.</param> /// <param name="rightElement">Right element.</param> /// <returns>The multiplication of the leftElement and rightElement (leftElement * rightElement)</returns> /// <exception cref="InvalidCastException">Thrown when the cast was not possible.</exception> public DirectSum <T, TRing> Multiplication( DirectSum <T, TRing> leftElement, DirectSum <T, TRing> rightElement) { var tuple = leftElement.Multiply(rightElement) as DirectSum <T, TRing>; if (tuple == null) { throw new InvalidCastException(); } return(tuple); }