2 // SoapInputFilterCollection.cs: Soap Input Filter Collection
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
10 using Microsoft
.Web
.Services
;
12 using System
.Collections
;
14 namespace Microsoft
.Web
.Services
{
16 public class SoapOutputFilterCollection
: CollectionBase
, ICloneable
{
18 public SoapOutputFilterCollection () {}
20 internal SoapOutputFilterCollection (ArrayList list
)
22 InnerList
.AddRange (list
);
25 public SoapOutputFilter
this [int index
] {
26 get { return (SoapOutputFilter) InnerList [index]; }
29 public int Add (SoapOutputFilter filter
)
32 throw new ArgumentNullException ("filter");
33 return InnerList
.Add (filter
);
36 public void AddRange (ICollection filters
)
38 // can't use list.AddRange because we must check every items
40 foreach (object o
in filters
) {
41 if (! (o
is SoapOutputFilter
))
42 throw new ArgumentException ("not SoapOutputFilter");
43 // we'll get the ArgumentNullException in Add
48 // LAMESPEC: Shallow (implemented) or deep clone (todo)
49 public object Clone ()
51 return new SoapOutputFilterCollection ((ArrayList
) InnerList
.Clone ());
54 public bool Contains (SoapOutputFilter filter
)
57 throw new ArgumentNullException ("filter");
58 return InnerList
.Contains (filter
);
61 public bool Contains (Type filterType
)
63 foreach (object o
in InnerList
) {
64 if (o
.GetType () == filterType
)
70 public int IndexOf (SoapOutputFilter filter
)
73 throw new ArgumentNullException ("filter");
74 return InnerList
.IndexOf (filter
);
77 public int IndexOf (Type filterType
)
79 if (filterType
== null)
80 throw new ArgumentNullException ("filterType");
82 foreach (object o
in InnerList
) {
83 if (o
.GetType () == filterType
)
90 public void Insert (int index
, SoapOutputFilter filter
)
93 throw new ArgumentNullException ("filter");
94 InnerList
.Insert (index
, filter
);
97 public void Remove (SoapOutputFilter filter
)
100 throw new ArgumentNullException ("filter");
101 InnerList
.Remove (filter
);
104 public void Remove (Type filterType
)
106 if (filterType
== null)
107 throw new ArgumentNullException ("filterType");
109 foreach (object o
in InnerList
) {
110 if (o
.GetType () == filterType
)
111 InnerList
.RemoveAt (i
);