コード例 #1
0
ファイル: Password.cs プロジェクト: crowdy/OpenStack-ConoHa
        /// <summary>
        /// Initializes a new instance of the <see cref="SetPasswordRequest"/> class
        /// with the specified username and password.
        /// </summary>
        /// <param name="username">The new username.</param>
        /// <param name="password">The new password.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="username"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="password"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="username"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="password"/> is empty.</para>
        /// </exception>
        public SetPasswordRequest(string username, string password)
        {
            if (username == null)
                throw new ArgumentNullException("username");
            if (password == null)
                throw new ArgumentNullException("password");
            if (string.IsNullOrEmpty(username))
                throw new ArgumentException("username cannot be empty");
            if (string.IsNullOrEmpty(password))
                throw new ArgumentException("password cannot be empty");

            PasswordCredential = new PasswordCredential(username, password);
        }
コード例 #2
0
ファイル: Password.cs プロジェクト: krowin24/backuptool
        /// <summary>
        /// Initializes a new instance of the <see cref="SetPasswordRequest"/> class
        /// with the specified username and password.
        /// </summary>
        /// <param name="username">The new username.</param>
        /// <param name="password">The new password.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="username"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="password"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If <paramref name="username"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="password"/> is empty.</para>
        /// </exception>
        public SetPasswordRequest(string username, string password)
        {
            if (username == null)
            {
                throw new ArgumentNullException("username");
            }
            if (password == null)
            {
                throw new ArgumentNullException("password");
            }
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("username cannot be empty");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException("password cannot be empty");
            }

            PasswordCredential = new PasswordCredential(username, password);
        }