你的位置:首页 > 软件开发 > ASP.net > Part 57 to 58 Why should you override ToString and Equal Method

Part 57 to 58 Why should you override ToString and Equal Method

发布时间:2015-10-12 01:00:35
Part 57 Why should you override ToString Methodsometimes you can override ToString method like that:namepace Examplepublic class MainClass{  ...

Part 57 Why should you override ToString Method

sometimes you can override ToString method like that:

namepace Examplepublic class MainClass{  Customer C = new Customer();  C.firstName = "Lin";  C.lastName="Gester";  Console.Write(C.ToString()); //it will write Lin Gester;}public class Customer{  public get='_blank'>string FirstName{get;set;}  public string LastName{get;set;}  public override string ToString()  {    return this.FirstName+""+this.LastName;  }}

原标题:Part 57 to 58 Why should you override ToString and Equal Method

关键词:string

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录