/// <summary> /// Returns the inverse of the specified element. /// </summary> /// <param name="element">The element.</param> /// <returns>The inverse of element (-element)</returns> /// <exception cref="InvalidCastException">When the cast to DirectSum from interface was not possible</exception> public DirectSum <T, TGroup> Inverse(DirectSum <T, TGroup> element) { var tuple = element.InverseElement() as DirectSum <T, TGroup>; if (tuple == null) { throw new InvalidCastException(); } return(tuple); }