1 //------------------------------------------------------------------------------
2 // <copyright file="EmptyCollection.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //------------------------------------------------------------------------------
8 * EmptyCollection class
10 * Copyright (c) 1999 Microsoft Corporation
13 namespace System.Web.Util {
15 using System.Collections;
18 * Fast implementation of an empty collection
20 internal class EmptyCollection: ICollection, IEnumerator {
22 private static EmptyCollection s_theEmptyCollection = new EmptyCollection();
24 private EmptyCollection() { }
26 // Return the same instance all the time, since it's immutable
27 internal static EmptyCollection Instance { get { return s_theEmptyCollection; } }
29 // ICollection implementation
30 IEnumerator IEnumerable.GetEnumerator() { return this; }
31 public int Count { get { return 0; } }
32 bool ICollection.IsSynchronized { get { return true; } }
33 object ICollection.SyncRoot { get { return this; } }
34 public void CopyTo(Array array, int index) { }
36 // IEnumerator implementation
37 object IEnumerator.Current { get { return null; } }
38 bool IEnumerator.MoveNext() { return false; }
39 void IEnumerator.Reset() { }