[Mono-dev] BitConverter differences

Jae Stutzman jaebird at gmail.com
Fri Jul 20 16:13:49 EDT 2007


Observe the following snippet:

byte[] test = { 3, 15, 3, 2, 5, 6, 4, 3 };
string value = BitConverter.ToString(test, 4, 0);
Console.WriteLine(value);

On MS the BitConverter.ToString returns an empty string if the (third param)
length is 0, on mono it throws a:

Unhandled Exception: System.ArgumentOutOfRangeException: capacity must be
greater than zero.
Parameter name: capacity
-1
  at System.Text.StringBuilder..ctor (System.String value, Int32 startIndex,
Int32 length, Int32 capacity) [0x00000]
  at System.Text.StringBuilder..ctor (Int32 capacity) [0x00000]
  at System.BitConverter.ToString (System.Byte[] value, Int32 startIndex,
Int32 length) [0x00000]


Known? Expected?

I don't want to annoy on the list, so you can stop me anytime.

Jae
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070720/56cc95f7/attachment.html 


More information about the Mono-devel-list mailing list