PC Review


Reply
Thread Tools Rate Thread

Convert BinaryString into int?

 
 
Keith
Guest
Posts: n/a
 
      10th Aug 2005
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


 
Reply With Quote
 
 
 
 
Jon Skeet
Guest
Posts: n/a
 
      12th Aug 2005
On 10/8/05 8:25 pm, in article #(E-Mail Removed),
"Keith" <(E-Mail Removed)> wrote:

> 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?

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

 
Reply With Quote
 
Keith
Guest
Posts: n/a
 
      12th Aug 2005
> 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 ;-)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Columns of Sensitive Information, and then convert back... =?Utf-8?B?V2lsbGlhbSBFbGVyZGluZw==?= Microsoft Excel Programming 1 12th Oct 2006 09:37 PM
convert numbers to word like 100 convert to one hundred only =?Utf-8?B?QWJkdWwgTmFzYXI=?= Microsoft Excel Crashes 1 20th Jul 2006 12:11 PM
Convert file to binary, send it over the network, and convert it b =?Utf-8?B?Q2hld2ll?= Microsoft Dot NET 0 9th Sep 2005 06:04 PM
Convert file to binary, send it over the network, and convert it b =?Utf-8?B?Q2hld2ll?= Microsoft Dot NET Framework 1 9th Sep 2005 06:01 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m =?Utf-8?B?YWdlbmRhOTUzMw==?= Microsoft Excel Misc 8 20th Jan 2005 10:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:38 AM.