2 // SoapInputFilterCollection.cs: Soap Input Filter Collection
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
11 using System.Collections;
13 namespace Microsoft.Web.Services {
15 public class SoapInputFilterCollection : CollectionBase, ICloneable {
17 public SoapInputFilterCollection () {}
19 internal SoapInputFilterCollection (ArrayList list)
21 InnerList.AddRange (list);
24 public SoapInputFilter this [int index] {
25 get { return (SoapInputFilter) InnerList [index]; }
28 public int Add (SoapInputFilter filter)
31 throw new ArgumentNullException ("filter");
32 return InnerList.Add (filter);
35 public void AddRange (ICollection filters)
37 // can't use list.AddRange because we must check every items
39 foreach (object o in filters) {
40 if (! (o is SoapInputFilter))
41 throw new ArgumentException ("not SoapInputFilter");
42 // we'll get the ArgumentNullException in Add
43 InnerList.Add (o as SoapInputFilter);
47 // LAMESPEC: Shallow (implemented) or deep clone (todo)
48 public object Clone ()
50 return new SoapInputFilterCollection ((ArrayList) InnerList.Clone ());
53 public bool Contains (SoapInputFilter filter)
56 throw new ArgumentNullException ("filter");
57 return InnerList.Contains (filter);
60 public bool Contains (Type filterType)
62 foreach (object o in InnerList) {
63 if (o.GetType () == filterType)
69 public int IndexOf (SoapInputFilter filter)
72 throw new ArgumentNullException ("filter");
73 return InnerList.IndexOf (filter);
76 public int IndexOf (Type filterType)
78 if (filterType == null)
79 throw new ArgumentNullException ("filterType");
81 foreach (object o in InnerList) {
82 if (o.GetType () == filterType)
89 public void Insert (int index, SoapInputFilter filter)
92 throw new ArgumentNullException ("filter");
93 InnerList.Insert (index, filter);
96 public void Remove (SoapInputFilter filter)
99 throw new ArgumentNullException ("filter");
100 InnerList.Remove (filter);
103 public void Remove (Type filterType)
105 if (filterType == null)
106 throw new ArgumentNullException ("filterType");
108 foreach (object o in InnerList) {
109 if (o.GetType () == filterType)
110 InnerList.RemoveAt (i);