Save registry through c# code

I want to change IP of the colibri vf61 device through c# code. I have changed the IP Address in registry. But How to save the the registry through C#.

 RegistryKey OurKey = Registry.LocalMachine;
 OurKey = OurKey.OpenSubKey(@"COMM\ENET2\Parms", true);
 foreach (string Keyname in OurKey.GetSubKeyNames())
                RegistryKey key = OurKey.OpenSubKey(Keyname,true);
                key.SetValue("IPAddress", "", RegistryValueKind.String);                   

Ok, I got the answer. just add the code:

ProcessStartInfo startinfo = new ProcessStartInfo();
startinfo.FileName = @"..\..\windows\update.exe";
startinfo.Arguments = "/f";

Actually SaveReg is nothing, just a shortcut of command “\windows\update.exe /f”.

You may also use the Flush method of RegistryKey to force the system to write the registry.

A better way could be to PInvoke the RegFlushKey function in the coredll.dl

[DllImport("coredll.dll", EntryPoint = "RegFlushKey")]
public static extern int RegFlushKey(uint hKey);

// const uint HKEY_LOCAL_MACHINE = 0x80000002
private uint HKey = 0x80000002;

// Call to save the HKLM