I don't quite understand the objective of the task Intermediate C3Q4 'WantMyPassword'

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;
            }
        }
    }
}

I managed to solve this on my own :slight_smile:
Looks like I don’t need to set the password. I only need to do the get password property.

1 Like