title: how to convert a number in binary to its decimal value using c#
body: <p>!!!!ANSWERED!!!!</p>
  
  <p>I need little help finishing my simple bit manipulation program.</p>
  
  <ol>
  <li>Asks the user for a number</li>
  <li>Print the number's binary representation</li>
  <li>Ask the user for bit position and bit value</li>
  <li>Apply the changes</li>
  <li>Displays the changes made by the user in binary</li>
  <li>?????? Convert that changes into a number again. ??????????</li>
  </ol>
  
  <p>I just need a little help with step 5, as you will see from my code I'm a complete noob, so please do not laugh :) Any help will be deeply appreciated.</p>
  
  <pre><code>Console.WriteLine("Enter integer number");
  int number = Convert.ToInt32(Console.ReadLine());
  string binaryString = Convert.ToString(number, 2);
  Console.WriteLine("The binary representation of {0} is", number);
  Console.WriteLine(binaryString.PadLeft(16, '0'));
  
  
  BitArray b = new BitArray(new int[] { number }); 
  
  
  Console.WriteLine("Enter bit's position (0 to 15)");
  int position = Convert.ToInt32(Console.ReadLine());
  
  Console.WriteLine("Enter bit's value (true or false)");
  bool value = Convert.ToBoolean(Console.ReadLine());
  
  b.Set(position, value); //set value to given position based on input from the user
  
  Console.WriteLine("Your changes transformed \n{0} \nto ",binaryString.PadLeft(16,'0'));
  
  for (int i = 15; i &gt;= 0; i--) 
  {
      if (b[i] == true)
      {
          Console.Write(1);
      }
      else
      {
          Console.Write(0);
      }
  }
  Console.WriteLine();
  </code></pre>