2 // Microsoft.Web.Services.Addressing.AddressList.cs
4 // Author: Todd Berman <tberman@gentoo.org>
6 // (C) 2003 Todd Berman
9 using System
.Collections
;
11 namespace Microsoft
.Web
.Services
.Addressing
14 public class AddressList
: ICollection
, IEnumerable
17 private ArrayList _list
;
21 _list
= new ArrayList ();
24 public int Add (Address address
)
27 throw new ArgumentNullException ("address");
29 return _list
.Add (address
);
32 public bool Contains (Address address
)
35 throw new ArgumentNullException ("address");
37 return _list
.Contains (address
);
40 public void CopyTo (Array array
, int index
)
43 throw new ArgumentNullException ("array");
45 if(index
< 0 || index
> _list
.Count
) {
46 throw new ArgumentOutOfRangeException ("index");
48 _list
.CopyTo (array
, index
);
51 public IEnumerator
GetEnumerator ()
53 return _list
.GetEnumerator ();
56 public int IndexOf (Address address
)
59 throw new ArgumentNullException ("address");
61 return _list
.IndexOf (address
);
64 public void Insert (int index
, Address address
)
66 if(index
< 0 || index
> _list
.Count
) {
67 throw new ArgumentOutOfRangeException ("index");
70 throw new ArgumentNullException ("address");
72 _list
.Insert (index
, address
);
75 public void Remove (Address address
)
77 _list
.Remove (address
);
80 public void RemoveAt (int index
)
82 if (index
< 0 || index
> _list
.Count
) {
83 throw new ArgumentOutOfRangeException ("index");
85 _list
.RemoveAt (index
);
89 get { return _list.Count; }
92 public bool IsFixedSize
{
93 get { return _list.IsFixedSize; }
96 public bool IsReadOnly
{
97 get { return _list.IsReadOnly; }
100 public bool IsSynchronized
{
101 get { return _list.IsSynchronized; }
104 public Address
this[int index
] {
106 if(index
< 0 || index
> _list
.Count
) {
107 throw new ArgumentOutOfRangeException ("index");
109 return (Address
) _list
[index
];
112 if(index
< 0 || index
> _list
.Count
) {
113 throw new ArgumentOutOfRangeException ("index");
115 _list
[index
] = value;
119 public object SyncRoot
{
120 get { return _list.SyncRoot; }