First, why do you use an int for the iBinaryNum?
Second, I would have put it in a string, and then rinse and repeat the following:
- have a counter, starting with 1
- take last digit, if it's 0, do nothing, if it's 1 multiply it by counter, add to temp result, multiply counter by 2.
- repeat with second from last ...
so, for 1010 , you'll have 0*1 + 1*2 +0*4 +1*8 = 10.
Here's another page : http://www.binaryhexconverter.com/binary-to-decimal-converter
Edit:
Well, to begin with, what you're asking for is for me to write your code.
All your really need is to figure out how to use loops (look here: http://csharp-station.com/Tutorial/CSharp/Lesson04 )
How to figure out the length of your string : string_name.Length
and then just run on your input from back to front (from length, down to 0), applying the algorithm.
If you really want to learn, follow the bread crumbs trail ...
If you just want someone to write your code ... well ... maybe someone else will ...