I’ve replaced the get and set method but kept getting this error:
Property ‘Password’ does not exist, has the wrong access modifiers, type, getter, or setter.
Any hints for me to solve this problem?
Thanks, in advance.
using System;
namespace Properties
{
class WantMyPassword
{
private string _password;
private string _userName;
public string UserName
{
get
{
return _userName;
}
set
{
_userName = value;
}
}
public string Password
{
get
{
if (_userName == "admin")
{
return _password;
}
else
{
return string.Empty;
}
}
set
{
_password = value;
}
}
}
}