Ishmael
Ishmael

Reputation: 121

Help me convert this line to C#

Please help me convert this line to C#.

objManagementBaseObject.SetPropertyValue("hDefKey", CType("&H" &
Hex(RegistryHive.LocalMachine), Long))

Related References in C#: System.Management

Thank you.

Additional Info:

Code was originally in VB.

Upvotes: 0

Views: 389

Answers (2)

Ishmael
Ishmael

Reputation: 121

objManagementBaseObject.SetPropertyValue("hDefKey", (long)RegistryHive.LocalMachine);

is the C# equivalent to the VB.NET line.

Thanks for the insight!

Upvotes: 0

Joel Coehoorn
Joel Coehoorn

Reputation: 416149

It looks like RegistryHive.LocalMachine is just an enum value, in which case passing it through Hex() is just a waste of time:

objManagmentBaseObject.SetPropertyValue("hDefKey", (long)RegistryHive.LocalMachine);

Upvotes: 3

Related Questions