--- /dev/null
+//\r
+// System.Collections.Generic.ReadOnlyCollection\r
+//\r
+// Author:\r
+// Carlos Alberto Cortez (carlos@unixmexico.org)\r
+//\r
+// (C) 2004 Carlos Alberto Cortez\r
+//\r
+\r
+//\r
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+//\r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+//\r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
+#if NET_2_0\r
+using System;\r
+using System.Collections;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace System.Collections.Generic\r
+{\r
+ [CLSCompliant (false)]\r
+ [ComVisible (false)]\r
+ public class ReadOnlyCollection <T> : ICollection<T>, IEnumerable<T>, IList<T>,\r
+ ICollection, IEnumerable, IList\r
+ {\r
+\r
+ Collection<T> collection;\r
+\r
+ public ReadOnlyCollection(IList <T> list)\r
+ {\r
+ collection = new Collection<T> (list, list.Count);\r
+ }\r
+\r
+ public bool Contains (T value)\r
+ {\r
+ return collection.Contains (value);\r
+ }\r
+\r
+ public void CopyTo (T[] array, int index)\r
+ {\r
+ collection.CopyTo (array, index);\r
+ }\r
+\r
+ public IEnumerator<T> GetEnumerator()\r
+ {\r
+ return collection.GetEnumerator ();\r
+ }\r
+\r
+ void ICollection.CopyTo (Array array, int index)\r
+ {\r
+ ((IList) collection).CopyTo (array, index);\r
+ }\r
+\r
+ void ICollection<T>.Add (T item)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ void ICollection<T>.Clear ()\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ bool ICollection<T>.Remove (T item)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ IEnumerator IEnumerable.GetEnumerator ()\r
+ {\r
+ return ((IEnumerable) collection).GetEnumerator ();\r
+ }\r
+\r
+ int IList.Add (object value)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ void IList.Clear()\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ bool IList.Contains (object value)\r
+ {\r
+ return ((IList) collection).Contains (value);\r
+ }\r
+\r
+ int IList.IndexOf (object value)\r
+ {\r
+ return ((IList) collection).IndexOf (value);\r
+ }\r
+\r
+ void IList.Insert (int index, object value)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ void IList.Remove (object value)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ void IList.RemoveAt(int index)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ void IList<T>.Insert (int index, T item)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ void IList<T>.RemoveAt (int index)\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ public int IndexOf (T value)\r
+ {\r
+ return collection.IndexOf (value);\r
+ }\r
+\r
+ public int Count {\r
+ \r
+ get {\r
+ return collection.Count;\r
+ }\r
+\r
+ }\r
+\r
+ bool ICollection.IsSynchronized {\r
+ \r
+ get {\r
+ return false;\r
+ }\r
+ \r
+ }\r
+\r
+ object ICollection.SyncRoot {\r
+ \r
+ get {\r
+ return ((IList) collection).SyncRoot;\r
+ }\r
+ \r
+ }\r
+\r
+ bool ICollection<T>.IsReadOnly {\r
+ \r
+ get {\r
+ return true;\r
+ }\r
+\r
+ }\r
+\r
+ bool IList.IsReadOnly {\r
+ \r
+ get {\r
+ return true;\r
+ }\r
+\r
+ }\r
+\r
+ bool IList.IsFixedSize {\r
+ \r
+ get {\r
+ return true;\r
+ }\r
+ \r
+ }\r
+\r
+ object IList.this [int index] {\r
+ \r
+ get {\r
+ return ((IList) collection) [index];\r
+ }\r
+\r
+ set\r
+ {\r
+ throw new NotSupportedException ();\r
+ }\r
+\r
+ }\r
+\r
+ public T this [int index] {\r
+ \r
+ get {\r
+ return collection [index];\r
+ }\r
+\r
+ set {\r
+ throw new NotSupportedException ();\r
+ }\r
+ }\r
+\r
+ protected IList<T> Items {\r
+ \r
+ get {\r
+ return collection.Items;\r
+ }\r
+ \r
+ }\r
+\r
+ }\r
+}\r
+\r
+#endif\r
+\r