Convert BinaryString into int?

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

Hello,

I have some binarystrings in the registry (from an older j++ app) that I
need to convert at runtime to ints. What is the best practice for this? In
J++ you could just call Integer.ParseInt(val, 2); I've tried
Convert.ToUInt32(object, int) but I can't get the compiler to believe that
is a valid overload; it keeps complaining that it can't convert an int to an
IFormatProvider, which is a different overload.

Is that convert function broken? Is there another way to do this or am I
just screwed?

Keith
 
I have some binarystrings in the registry (from an older j++ app) that I
need to convert at runtime to ints. What is the best practice for this? In
J++ you could just call Integer.ParseInt(val, 2); I've tried
Convert.ToUInt32(object, int) but I can't get the compiler to believe that
is a valid overload; it keeps complaining that it can't convert an int to an
IFormatProvider, which is a different overload.

Is that convert function broken? Is there another way to do this or am I
just screwed?

There isn't a method Convert.ToUInt32(object, int). There's
Convert.ToUInt32(string, int) however - perhaps you just need to cast val to
a string first?
 
There isn't a method Convert.ToUInt32(object, int). There's
Convert.ToUInt32(string, int) however - perhaps you just need to cast val
to
a string first?

Apparently I can't read parameter lists, or at least not yesterday. Yes,
this works fine if cast. Thanks for the boot to the head ;-)
 
Back
Top