/// <summary> /// Converts the term to a <see cref="String"/>. /// </summary> /// <param name="term">The term to convert.</param> /// <returns>The resulting value.</returns> /// <exception cref="InvalidCastException"> /// The term could not be converted. /// </exception> public static String ToString(this ITerm term) { #region Contract if (term == null) { throw new ArgumentNullException(nameof(term)); } #endregion var result = term.AsString(); if (result == null) { throw new InvalidCastException($"Can't cast term {term} to String."); } return(result); }