public static bool ElementaryEqualsThenEquatableEquals <T>(IEquatable <T> obj, object other)
 {
     return(ElementaryEquals(obj, other)
            ?? (obj.GetType() != other.GetType()
             ? false
             : obj.Equals((T)other)));
 }
 /// <summary>
 /// 插入一条数据
 /// </summary>
 /// <param name="entity">实体对象</param>
 /// <returns>返回插入的数据数量</returns>
 public void Insert(IEquatable <TEntity> entity)
 {
     lock (DataList)
     {
         if (DataList.Contains(entity))
         {
             throw new Exception($"{entity.GetType().Name}内存表中已存在相同数据,插入失败!");
         }
         DataList.Add(entity);
     }
 }
    // here I try to utilize the Stack class
    public void UseStack(Stack stack)
    {
        // what type should I use for the variable to hold the result of the Stack.Pop method?
        type ??? item = stack.Pop();
        // if I use IEquatable
        IEquatable item1 = stack.Pop();
        IEquatable item2 = stack.Pop();

        item1.Equals(item2);                // then I can do this
        Type   itemType = item1.GetType();  // but I can't do this
        string s        = item1.ToString(); // nor can I do this
        // Ok, this calls for another interface that composes all of these other interfaces into one
    }