Link to home
Start Free TrialLog in
Avatar of schubduese
schubdueseFlag for Switzerland

asked on

Get Registry Type with C#

I need to retrieve the Registry Type (e.g. REG_SZ) with C#

Any idea how to get this data?
Avatar of Anthony408
Anthony408
Flag of United States of America image

Hi schubduese,

I am not quite sure what you mean by Registry Type, but here are some useful C# Registry Links that might point you in the right direction.

C# Registry Basics:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=264

Registry In's and Out's Using C#:
http://www.csharphelp.com/archives2/archive430.html

Read, write and delete from registry with C#"
http://www.codeproject.com/KB/system/modifyregistry.aspx

Sorry if this is not what you are looking for.

-Anthony
ASKER CERTIFIED SOLUTION
Avatar of rendaduiyan
rendaduiyan
Flag of China image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of schubduese

ASKER

rendaduiyan, I think you mean .GetValueKind(yourvaluename)

With this, it works... it reports for example "String"
That means I have to change it like this:
private String mValType = String.Empty;
 
switch (rvk.ToString())
{
    case "String":
        mValType = "REG_SZ";
        break;
    ...
    ...
 
}

Open in new window

the returned value is a enum,
RegistryValueKind:
String, REG_SZ
ExpandString, REG_EXPAND_SZ
Binary, REG_BINARY
DWord, REG_DWORD
MultiString, REG_MULTI_SZ
QWord, REG_QWORD
Unknown

It is easy for you to handle the enum.