[Mono-devel-list] convert char[] in c struct to byte[] in C# struct??

Jonathan Pryor jonpryor at vt.edu
Sun Oct 3 15:58:52 EDT 2004


On Sun, 2004-10-03 at 13:36, Michael J. Ryan wrote:
<snip/>
> Thanks a bunch though, will keep a note of this.
> Beyond that, any idea why a char[]'s .ToString() would
> keep giving me "System.Char[]" instead of the value?

Because char[] is a System.Array, and System.Array.ToString() prints out
the type of the array. :-)

There is no way to override Object.ToString() specifically for char[],
so this is a reasonable thing to do.  (Another reasonable thing would be
to print the contents of the array, but alas it doesn't do this.)

> Same went for Convert.ToString(char[]); (I'm using the
> variable for the char[])

This is invoking Convert.ToString(Object o), which in turn returns
"o.ToString()" (in this situation).

 - Jon





More information about the Mono-devel-list mailing list