/// <summary> /// Returns whether the two specified coproducts are structurally equal. Note that two nulls are /// considered structurally equal coproducts. /// </summary> public static bool CoproductEquals(this ICoproduct c1, object that) { if (that is ICoproduct c2 && c1 != null && c2 != null && c1.GetType() == c2.GetType()) { return(c1.CoproductRepresentation().Equals(c2.CoproductRepresentation())); } return(c1 == that); }
/// <summary> /// Returns string representation of the specified coproduct type. /// </summary> public static string CoproductToString(this ICoproduct c) { return (c.GetType().SimpleName() + "(" + GetOrdinal(c.CoproductDiscriminator) + "(" + c.CoproductValue.SafeToString() + ")" + ")"); }