Example #1
0
        /// <summary>
        ///	Create a sub key.
        /// </summary>
        public RegistryKey CreateSubKey(string subkey)
        {
            AssertKeyStillValid();
            AssertKeyNameNotNull(subkey);
            AssertKeyNameLength(subkey);

            if (!IsWritable)
            {
                throw new UnauthorizedAccessException("Cannot write to the registry key.");
            }
            return(RegistryApi.CreateSubKey(this, subkey));
        }
Example #2
0
        /// <summary>
        ///	Create a sub key.
        /// </summary>
        public RegistryKey CreateSubKey(string subkey)
        {
            AssertKeyStillValid();
            AssertKeyNameNotNull(subkey);
            if (subkey.Length > 255)
            {
                throw new ArgumentException("keyName length is larger than 255 characters", subkey);
            }

            if (!IsWritable)
            {
                throw new UnauthorizedAccessException("Cannot write to the registry key.");
            }
            return(RegistryApi.CreateSubKey(this, subkey));
        }