all groups > dotnet framework > december 2003 >
You're in the

dotnet framework

group:

RegistryKey class anyway of getting value type?


RegistryKey class anyway of getting value type? unemotionalhumanoid
12/31/2003 9:24:18 PM
dotnet framework:
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

Re: RegistryKey class anyway of getting value type? Jon Skeet [C# MVP]
1/1/2004 10:33:22 AM
[quoted text, click to view]

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[])
....

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
AddThis Social Bookmark Button