Hello, I’m working on this task:
Replace getter and setter methods with corresponding properties. The property’s name should be the same as its originating methods, but without “Get” and “Set”. For example, if the method looks like this: int GetSize(), then the property should have type int and name Size. Leave all access modifiers the same.
Here is my code:
namespace Properties
{
class WantMyPassword
{
private string _password;
private string _userName;
public string GetPassword()
{
if (_userName == "admin")
return _password;
else
return string.Empty;
}
}
}
Can anyone please help me to solve it?