title: C# not supported ulong to bin/oct/dec/hex string -> Convert.ToString(ulong, base)
body: <p>I would have the bin/oct/dec/hex values of ulong values as string. So I have to use convert.tostring(, base) with desired base. To support this, I cast the ulong value to long, while long is supported with convert.tostring(, base) to have the bin/oct/dec/hex value as string for ulong. Am I right? </p>
  
  <pre><code>//while Convert.ToString does not support ulong with base
  //Convert.ToString(ulong.MaxValue, 2);
  
  // following code sample is the same like not supported ToString on line 2, right? 
  ulong ul = ulong.Maxvalue; 
  long l = (long)ul;
  Convert.ToString(l, 8); //8 =&gt; oct, 2 =&gt; bin
  </code></pre>
  
  <p>OK, for dec, I just can use ul.ToString();
  for Hex, ul.ToString("X");</p>
  
  <p>Based on, <a href="https://stackoverflow.com/questions/13056230/copy-bits-from-ulong-to-long-in-c-sharp">Copy bits from ulong to long in C#</a> I'm a little confused. Does this give me the correct Oct and Bin string representation for ulong? </p>
  
  <p>related gist: 
  <a href="https://gist.github.com/chubbson/375b535243c166d28119" rel="nofollow noreferrer">https://gist.github.com/chubbson/375b535243c166d28119</a></p>