C#语法问题 this的用法
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的具体用法
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的具体用法
其他人气:442 ℃时间:2020-01-27 16:51:03
优质解答
你这里声明了一个类Users:public class Users那么,在类中的代码里使用this,指代的就是 Users 这个类.比如说this._userid,指的就是Users类下面的成员int _userid(你已经在代码里声明过了成员int _userid:private i...
我来回答
类似推荐
猜你喜欢
- 1How many students have been to the county in your class?---there are only a few,if_____
- 2一箩筐内有橘子、梨、苹果、若干个,已知梨的个数是橘子个数的4/5,苹果的个数是橘子个数的2/3,梨的个数的3/4比苹果少2个,箩筐内有橘子多少个?
- 3桌子上的书比书包里的书多.中译英
- 4自然界中的物理现象
- 5已知x-y=3,xy=二分之一,求(1)x平方+y平方的值(2)2x平方y-2xy平方的值
- 627是我的倍数,我共有3个因数,指哪个数
- 7一道C语言题目 有3个整数a,b,c,由键盘输入,输出其中最大的数,请编写程序.
- 8英语翻译
- 9在书房门上贴的对联是:
- 10如图,在三角形ABC中,AB=AC,角A=40度,AB的垂直平分线MN交AC于点D,求角DCB度数.