RegistryKey class anyway of getting value type?

  • Thread starter Thread starter unemotionalhumanoid
  • Start date Start date
U

unemotionalhumanoid

I am using the RegistryKey class to get access to the windows registry, I
can get a value from the registry by doing:

RegistryKey registryKey1 =
Registry.LocalMachine.OpenSubKey("Software\\test");
registryKey1.GetValue("test2")

How do I find out what type "test2" is? i.e. string, dword, binary value
etc.

Thank you
 
unemotionalhumanoid said:
I am using the RegistryKey class to get access to the windows registry, I
can get a value from the registry by doing:

RegistryKey registryKey1 =
Registry.LocalMachine.OpenSubKey("Software\\test");
registryKey1.GetValue("test2")

How do I find out what type "test2" is? i.e. string, dword, binary value
etc.

Just retrieve the value and then find out what type it is in the usual
way:

if (value is string)
....
else if (value is int)
....
else if (value is byte[])
....
 
Back
Top