The correct usage of the Property's getter setter method in C # (create an FORM with C #)

xiaoxiao2021-03-06  14

Usage and Java are slightly different, each property is private, you can give him an external public setter getter method. Just as shown below. Using system;

Namespace wztj.page.user.model {///

/// summary description for user. /// public class user {public user () {// // Todo: Add Constructionor logic here / /}

public User (long id, string username, string password, string province, string city, string address, string representive, string telephone, string post, string mail, string fax, string company) {this.id = id; this.username = username; this.password = password; this.province = province; this.city = city; this.address = address; this.representive = representive; this.telephone = telephone; this.post = post; this.fax = fax; THIS.MAIL = Mail; this.post = post; this.company = company;}

Private long id; public long id;} set {id = value;}} private string username; public string username {get {return username;} set {username = value;}}

PRIVATE STRING password; public string password {get {qurn password;} set {password = value;}}

PRIVATE STRING, PUBLIC STRING, PROVINCE;} set {province = value;}}

PRIVATE STRING CITY;} set {city = value;}}

Private string address; public string address {get {return address;} set {address = value;}}

private string representive; public string Representive {get {return representive;} set {representive = value;}} private string telephone; public string Telephone {get {return telephone;} set {telephone = value;}} private string post; public string POST {GET {RETURN POST;}} private string mail; public string mail {get {mail = value; Set {fax = value;}}

PRIVATE STRING COMPANY;} set {company = value;}}}}

转载请注明原文地址:https://www.9cbs.com/read-67530.html

New Post(0)