Microsoft.Win32.KeyHandler.Delete C# (CSharp) Méthode

Delete() public static méthode

public static Delete ( string dir ) : bool
dir string
Résultat bool
		public static bool Delete (string dir)
		{
			if (!Directory.Exists (dir)) {
				string volatile_dir = GetVolatileDir (dir);
				if (!Directory.Exists (volatile_dir))
					return false;

				dir = volatile_dir;
			}

			Directory.Delete (dir, true);
			Drop (dir);
			return true;
		}

Usage Example

        public void DeleteKey(RegistryKey rkey, string keyname, bool throw_if_missing)
        {
            KeyHandler self = KeyHandler.Lookup(rkey, true);

            if (self == null)
            {
                // key is marked for deletion
                if (!throw_if_missing)
                {
                    return;
                }
                throw new ArgumentException("the given value does not exist");
            }

            string dir = Path.Combine(self.Dir, ToUnix(keyname));

            if (!KeyHandler.Delete(dir) && throw_if_missing)
            {
                throw new ArgumentException("the given value does not exist");
            }
        }