2010-04-06 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System / System.ComponentModel / ListSortDescriptionCollection.cs
blob5eeb77d5fcd705a6e43f6ace23d23e7a595221d6
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 //
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
22 // Author:
23 // Pedro Martínez Juliá <pedromj@gmail.com>
24 // Ivan N. Zlatev <contact@i-nz.net>
28 #if NET_2_0
30 using System.Collections;
32 namespace System.ComponentModel {
34 public class ListSortDescriptionCollection : IList, ICollection, IEnumerable {
36 ArrayList list;
38 public ListSortDescriptionCollection () {
39 list = new ArrayList();
42 public ListSortDescriptionCollection (ListSortDescription[] sorts) {
43 list = new ArrayList();
44 foreach (ListSortDescription item in sorts)
45 list.Add (item);
48 public int Count {
49 get { return list.Count; }
52 public ListSortDescription this [int index] {
53 get { return list[index] as ListSortDescription; }
54 set { throw new InvalidOperationException("ListSortDescriptorCollection is read only."); }
57 public bool Contains (object value) {
58 return list.Contains(value);
61 public void CopyTo (Array array, int index) {
62 list.CopyTo(array, index);
65 public int IndexOf (object value) {
66 return list.IndexOf(value);
69 object IList.this [int index] {
70 get { return this[index]; }
71 set { throw new InvalidOperationException("ListSortDescriptorCollection is read only."); }
74 bool IList.IsFixedSize {
75 get { return list.IsFixedSize; }
78 bool ICollection.IsSynchronized {
79 get { return list.IsSynchronized; }
82 object ICollection.SyncRoot {
83 get { return list.SyncRoot; }
86 bool IList.IsReadOnly {
87 get { return list.IsReadOnly; }
90 IEnumerator IEnumerable.GetEnumerator () {
91 return list.GetEnumerator();
94 int IList.Add (object value) {
95 return list.Add(value);
98 void IList.Clear () {
99 list.Clear();
102 void IList.Insert (int index, object value) {
103 list.Insert(index, value);
106 void IList.Remove (object value) {
107 list.Remove(value);
110 void IList.RemoveAt (int index) {
111 list.RemoveAt(index);
118 #endif