C#语法问题 this的用法public class Users{private int _userid;private string _username;private string _userpwd;public int UserId{get { return this._userid; }set { this._userid = value; }}public string UserName{get { return this._username; }set { this._username = value; }}public string UserPwd{get { return this._userpwd; }set { this._userpwd = value; }}public Users(){//// TODO:在此处添加构造函数逻辑//}public Users(int UserId,string UserName,string UserPwd){this._userid =
C#语法问题 this的用法
public class Users
{
private int _userid;
private string _username;
private string _userpwd;
public int UserId
{
get { return this._userid; }
set { this._userid = value; }
}
public string UserName
{
get { return this._username; }
set { this._username = value; }
}
public string UserPwd
{
get { return this._userpwd; }
set { this._userpwd = value; }
}
public Users()
{
//
// TODO:在此处添加构造函数逻辑
//
}
public Users(int UserId,string UserName,string UserPwd)
{
this._userid = UserId;
this._username = UserName;
this._userpwd = UserPwd;
}
public Users(SqlDataReader Dr)
{
this._userid = Convert.ToInt32(Dr["UserId"]);
this._username = Dr["UserName"].ToString();
this._userpwd = Dr["UserPwd"].ToString();
}
上面代码中用了很多this 谁能讲一下啊是什么用意 在什么情况下一定要加上this
不要复制给我帮助中公式般回答 通俗的讲一下this的具体用法
你这里声明了一个类Users:public class Users那么,在类中的代码里使用this,指代的就是 Users 这个类.比如说this._userid,指的就是Users类下面的成员int _userid(你已经在代码里声明过了成员int _userid:private i...