用法和java的稍有不同,每一个property都是private的,可给他做一个外部的public setter getter方法。
就像下面所示。
using System;
namespace wztj.page.user.model
{
/// <summary>
/// Summary description for User.
/// </summary>
public class User
{
public User()
{
//
// TODO: Add constructor 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
{
get {return id;}
set {id = value;}
}
private string username;
public string Username
{
get {return username;}
set {username = value;}
}
private string password;
public string Password
{
get {return password;}
set {password = value;}
}
private string province;
public string Province
{
get {return province;}
set {province = value;}
}
private string city;
public string City
{
get {return 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;}
set {post = value;}
}
private string mail;
public string Mail
{
get {return mail;}
set {mail = value;}
}
private string fax;
public string Fax
{
get {return fax;}
set {fax = value;}
}
private string company;
public string Company
{
get {return company;}
set {company = value;}
}
}
}