Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine A Registry Value's Type
Message
From
11/07/2009 11:59:52
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01410985
Message ID:
01411604
Views:
39
But Viv, I think that only answers part of Kevin's question. What do you do with it after that? IOW, you have this code:
            RegistryValueKind kind = x.GetValueKind("Update Status");
            Object o = x.GetValue("Update Status");
Kevin doesn't want to use an Object o, he wanted to be able to cast the object returned from x.GetValue() to the proper type ... which, I'm assuming from your reply, has something to do with the RegistryValueKind kind. But the question is: what do you do with kind?

~~Bonnie



>>I'm using Registry.GetValue(). GetValue returns an object. How do you know the type of data being returned,
>>such as REG_SZ or REG_DWORD, so that it can be cast correctly?
>
>You need a RegistryKey instance for this. e.g.:
>            RegistryKey rk = Registry.LocalMachine;
>            RegistryKey x = rk.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
>            RegistryValueKind kind = x.GetValueKind("Update Status");
>            Object o = x.GetValue("Update Status");
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform