Friday, February 6, 2009

Converting from binary to decimal

The following code will get you the decimal equivalent of a binary string:

long l = Convert.ToInt64("1011000", 2);
int i = (int)l;
MessageBox.Show("Decimal equivalent = " + i.ToString(),"Binary to Decimal");

Binary to decimal in .NET

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails