日期:2014-05-20  浏览次数:20748 次

帮我看看这样设计一个用户类对不对
这个是设计的一个用户类,代码如下:
public   class   pubUser
        {  
                private   int   ID=0;

                public   string   userName
                {
                        set   {   this.userName   =   value;   }//这里报错!!
                        get   {   return   this.userName;   }
                }

                public   string   userPass
                {
                        set   {   this.userPass   =   value;   }
                        get   {   return   this.userPass;   }
                }

                public   string   userRights
                {
                        set   {   this.userRights   =   value;   }
                        get   {   return   this.userRights;   }
                }
                /*
                public   static   string   userName;
                public   static   string   userPass;
                public   static   string   userEmail;
                public   static   string   userCnName;
                public   static   string   userTel;
                public   static   string   userRights;
                public   static   string   userSign;
                */
        }


使用时这样
                        while   (oReader.Read())
                        {
                                if   (oReader.HasRows)
                                {
                                        this.DialogResult   =   DialogResult.OK;
                                        pubUser   user   =   new   pubUser();
                                        user.userName   =   this.tb_userName.Text;