Namespace problem...Business Object?

Posted by Pramodmca09 under ASP.NET on 9/12/2009 | Views : 1477 | Status : [Member] | Replies : 2
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for User
/// </summary>
///

namespace MHIL.BO
{
public class User
{
public User()
{
//on this line i'm gettgin error like ' } ' expected
private string _UserName;

public string UserName
{
get { return _UserName;}
set { _UserName = value;}
}
}

}
}




Responses

Posted by: Lakhangarg on: 9/12/2009 [Member] [Moderator] Silver

Up
0
Down
Hi-

using System.Web;

using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for User
/// </summary>
///

namespace MHIL.BO
{
public class User
{
public User()
{
//on this line i'm gettgin error like ' } ' expected
private string _UserName;
}
public string UserName
{
get { return _UserName;}
set { _UserName = value;}
}


}
}


Now check it ..

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com

Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RtpHarry on: 9/12/2009 [Member] [MVP] Bronze

Up
0
Down
The problem is that you are trying to declare the private member variable _UserName inside the constructor User().

Move those lines outside of User() like:

namespace MHIL.BO

{
/// <summary>
/// Summary description for User
/// </summary>
public class User
{
//on this line i'm gettgin error like ' } ' expected
private string _UserName;

public string UserName
{
get { return _UserName;}
set { _UserName = value;}
}

public User()
{
}
}
}


Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response