tags:

views:

70

answers:

1

Not sure if I worded the title correctly, so my apologies.

I want to simply convert an integer to strings that hold the binary representation of that integer.

Example:
116 would convert to "1110100"

Is there anything built into .Net or will I need to write a small parsing algorithm?

+12  A: 

This will do it:

// bin = "1110100"
var bin = Convert.ToString(116, 2)

The second parameter specifies which base to convert to.

alexn
I figured .Net had some type of method but couldn't find anything before your answer. Thanks so much!
jlafay