[Mono-devel-list] Zero Length Arrays

Jonathan Gilbert 2a5gjx302 at sneakemail.com
Mon Jan 12 12:16:08 EST 2004


At 08:42 PM 11/01/2004 -0500, you wrote:
>On Sun, 2004-01-11 at 20:34, Piers Haken wrote:
>> What about locking? 
>Multiple threads could try to allocate a zero length array at the same
>time.

What about this pattern?

object[] x = new object[0];
object[] y = new object[0];

if (object.ReferenceEquals(x, y)) throw new
TheRuntimeIsInsaneException("Houston, we have a problem");

Anyway, are arrays of length 0 really being created so often that a cheap
speed hack is needed?

Jonathan



More information about the Mono-devel-list mailing list