开发者

ArrayList.GetRange(0,54).ToString() is returning "System.Collections.ArrayList+Range"

54 should be unimportant.

The arrayList is filled during an ArrayList.AddRange(return_value) where byte[] return_value = (byte[])this.in_buffer.ToArray(typeof(byte)) (and in_buffer is type ArrayList also filled with AddRange(byte[] bytes))

Why? I didn't write the typeof(byte) part. I plan to go read about it now. Do I need to make use of something similar? While writing this, this开发者_如何学运维 possibility occurred to me.


The ToString method on System.Object returns the name of the type by default, so the values of the array are not returned, which I guess you were looking for.


ArrayList.GetRange is implemented by returning a subclass of ArrayList called Range, which is actually nested within ArrayList, that's all. ToString is just showing that type's name.

What were you expecting?


System.Collections.ArrayList contains a nested class called Range, which derives from ArrayList. This is the type that is returned by GetRange, but it is exposed as an ArrayList. The + part of the returned string indicates a nested type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜