8
I was going through Edulinq by Jon Skeet, and I came across the following code, Page 23, in which he implements cache mechanism for Empty() operator of Linq
private static class EmptyHolder<T>
{
internal static readonly T[] Array = new T[0];
}
My question is, how does this actually cache the Array variable?
Optionally, How does it work in CLR?
Edit: Also following that, he mentions there was a revolt against returning an array. Why should anybody not return an array (even if it is 0 sized?)?