Ejemplo n.º 1
0
 /// <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);
 }
Ejemplo n.º 2
0
 /// <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() +
          ")" +
          ")");
 }