GSF.Identity.UserInfo.CreateLocalUser C# (CSharp) Метод

CreateLocalUser() публичный статический Метод

Creates a new local user if it does not exist already.
or was null. No was specified. Could not create local user.
public static CreateLocalUser ( string userName, string password, string userDescription = null ) : bool
userName string User name to create if it doesn't exist.
password string Password to user for new user.
userDescription string Optional user description.
Результат bool
        public static bool CreateLocalUser(string userName, string password, string userDescription = null)
        {
            if ((object)userName == null)
                throw new ArgumentNullException(nameof(userName));

            if ((object)password == null)
                throw new ArgumentNullException(nameof(password));

            // Remove any irrelevant white space
            userName = userName.Trim();

            if (userName.Length == 0)
                throw new ArgumentException("Cannot create local user: no user name was specified.", nameof(userName));

            if (Common.IsPosixEnvironment)
                return UnixUserInfo.CreateLocalUser(userName, password, userDescription);

            return WindowsUserInfo.CreateLocalUser(userName, password, userDescription);
        }