添加了ToString 函数。 示例: tb_mail t = new tb_mail(); t.emailid = null; t.context = "发生的发"; string tx = t.ToString(); tb_mail ttt = new tb_mail(tx); if (t.context.Length == ttt.context.Length )//注意, 这个大小是字符串长度, 一个汉字算一个。 因此这里会有出入。 { Console.WriteLine(""); } if (ttt.ToString() == tx)//但是最终结果都是一样的。 { Console.WriteLine(""); }
转载于:https://my.oschina.net/mysticboy/blog/574