///& lt; Summary>
///registry
///& lt;/summary>
The class Regedit
{
Private const string SUB_KEY="SOFTWARE";
Private static readonly RegistryKey HKML;
Private static readonly RegistryKey SOFTWARE;
The static Regedit ()
{
HKML=Registry. CurrentUser;
SOFTWARE=HKML. OpenSubKey (SUB_KEY, true);
}
///& lt; Summary>
///traverse the nodes all names and values
///& lt;/summary>
///& lt; Param name="node" & gt;
///& lt; Returns>
Public static string [] GetData_s (string node)
{
String [] strArray={};
RegistryKey TMP=SOFTWARE. OpenSubKey (node, true);
The foreach (var item in TMP. GetValueNames ())
{
StrArray=strArray. Concat (new string [] {$" {item}, {(string) GetData (node, item)} "}). The ToArray ();
}
Return strArray;
}
///& lt; Summary>
///read the value of individual name
///& lt;/summary>
///& lt; Param name="node" & gt; Node & lt;/param>
///& lt; Param name="name" & gt; Name & lt;/param>
///& lt; Returns>
Public static object GetData (string node, string name)
{
RegistryKey TMP=SOFTWARE. OpenSubKey (node, true);
The return of TMP? GetValue (name);
}
///& lt; Summary>
///write value
///& lt;/summary>
///& lt; Param name="node" & gt; Node & lt;/param>
///& lt; Param name="name" & gt; Name & lt;/param>
///& lt; Param name="value" & gt; Value & lt;/param>
Public static void AddItem (string node, string name, object value)
{
RegistryKey TMP=SOFTWARE. CreateSubKey (node);
TMP? SetValue (name, value);
}
///& lt; Summary>
///delete value
///& lt;/summary>
///& lt; Param name="node" & gt;
///& lt; Param name="name" & gt;
///& lt; Returns>
Public static void DelData (string node, string name)
{
RegistryKey TMP=SOFTWARE. OpenSubKey (node, true);
TMP. DeleteSubKey (name, true);
}
}
Regedit. AddItem (" aaa ", "BBB", "CCC");
Regedit. DelData (" aaa ", "BBB");
CodePudding user response:
In addition, I want to delete the aaa BBB below the data