重写方法:
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"
时间: 2024-11-06 14:12:37
重写方法:
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"