title: Bitmap to Base64String
body: <p>i am trying to convert a bitmap to a base64 string.i can convert to from string to bitmap...but it seems like there is a problem when converting from bitmap to string.I was hoping you guys could give me a hand</p>
  
  <pre><code>    public static string BitmapToString(BitmapImage image)
      {
  
          Stream stream = image.StreamSource ;
          Byte[] buffer = null;
          if (stream != null &amp;&amp; stream.Length &gt; 0)
          {
              using (BinaryReader br = new BinaryReader(stream))
              {
                  buffer = br.ReadBytes((Int32)stream.Length);
              }
          }
  
          return Convert.ToBase64String(buffer);
      }
  </code></pre>
  
  <p>it gets a ArgumentNullException was unhandled 
  Value cannot be null.
  Parameter name: inArray
  when returning  Convert.ToBase64String(buffer)</p>
  
  <p>Help?</p>