Dot Net Capsules

A Capsule on .NET, everyday, keeps you .NetHealthy!!!!

My Photo
Name:

Programmer. Visit my new blog at www.ashishsheth.com

Tuesday, April 26, 2005

Converting an Integer to Binary format

Use Convert.ToString(number, 2) to convert an integer to Binary format.
Following is the sample code:

public string IntToBinary(int num) {
return Convert.ToString(num, 2) ;
}


when you call this function passing number 3 it will return '11' and when you call this function passing number 300 it will return '100101100'.

So how's that!!!!!!!!!!!

3 Comments:

Blogger ArunGG_MVP said...

Cool Buddy :) Keeep your good work

Regards,
Arun Ganesh
http://arun.mvpblog.com

Wed Jan 11, 11:54:00 AM  
Anonymous Anonymous said...

That was good tip.

Wed Mar 25, 01:31:00 AM  
Blogger Karmakul said...

toBase
The base of the return value, which must be 2, 8, 10, or 16.

Fri May 22, 11:36:00 AM  

Post a Comment

<< Home

You Visitor Number:
Free Web Site Counter
Free Counter
free counters