重写方法:

public class MyList<T> : List<T> where T : IConvertible
{
    public override string ToString()
    {
        return "123";
    }
}

调用:

MyList<string> list = new MyList<string>();

MessageBox.Show(list.ToString());

执行结果:"123"

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-16
  • 2021-06-09
  • 2021-11-02
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案