* ParameterCollection.cs: fixed IndexOfString, this indexer should be case insensitive
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Description / PortTypeCollection.cs
index 2017189b2c34fe3a86e4243c875f9d693b5afc00..43fd98aed9a4499e040ae16eb9cb205e615c7146 100644 (file)
-// \r
-// System.Web.Services.Description.PortTypeCollection.cs\r
-//\r
-// Author:\r
-//   Tim Coleman (tim@timcoleman.com)\r
-//\r
-// Copyright (C) Tim Coleman, 2002\r
-//\r
-\r
-namespace System.Web.Services.Description {\r
-       public sealed class PortTypeCollection : ServiceDescriptionBaseCollection {\r
-\r
-               #region Fields\r
-\r
-               ServiceDescription serviceDescription;\r
-\r
-               #endregion // Fields\r
-\r
-               #region Constructors\r
-\r
-               internal PortTypeCollection (ServiceDescription serviceDescription)\r
-               {\r
-                       this.serviceDescription = serviceDescription;\r
-               }\r
-\r
-               #endregion // Constructors\r
-\r
-               #region Properties\r
-\r
-               public PortType this [int index] {\r
-                       get { \r
-                               if (index < 0 || index > Count)\r
-                                       throw new ArgumentOutOfRangeException ();\r
-\r
-                               return (PortType) List[index]; \r
-                       }\r
-                        set { List [index] = value; }\r
-               }\r
-\r
-               public PortType this [string name] {\r
-                       get { return this [IndexOf ((PortType) Table[name])]; }\r
-               }\r
-\r
-               #endregion // Properties\r
-\r
-               #region Methods\r
-\r
-               public int Add (PortType portType) \r
-               {\r
-                       Insert (Count, portType);       \r
-                       return (Count - 1);\r
-               }\r
-\r
-               public bool Contains (PortType portType)\r
-               {\r
-                       return List.Contains (portType);\r
-               }\r
-\r
-               public void CopyTo (PortType[] array, int index) \r
-               {\r
-                       List.CopyTo (array, index);\r
-               }\r
-\r
-               protected override string GetKey (object value) \r
-               {\r
-                       if (!(value is PortType))\r
-                               throw new InvalidCastException ();\r
-                       return ((PortType) value).Name;\r
-               }\r
-\r
-               public int IndexOf (PortType portType)\r
-               {\r
-                       return List.IndexOf (portType);\r
-               }\r
-\r
-               public void Insert (int index, PortType portType)\r
-               {\r
-                       SetParent (portType, serviceDescription);\r
-                       List.Insert (index, portType);\r
-               }\r
-       \r
-               public void Remove (PortType portType)\r
-               {\r
-                       List.Remove (portType);\r
-               }\r
-                       \r
-               protected override void SetParent (object value, object parent)\r
-               {\r
-                       ((PortType) value).SetParent ((ServiceDescription) parent); \r
-               }\r
-                       \r
-               #endregion // Methods\r
-       }\r
-}\r
+// 
+// System.Web.Services.Description.PortTypeCollection.cs
+//
+// Author:
+//   Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Web.Services.Description {
+       public sealed class PortTypeCollection : ServiceDescriptionBaseCollection {
+
+               #region Constructors
+
+               internal PortTypeCollection (ServiceDescription serviceDescription)
+                       : base (serviceDescription)
+               {
+               }
+
+               #endregion // Constructors
+
+               #region Properties
+
+               public PortType this [int index] {
+                       get { 
+                               if (index < 0 || index > Count)
+                                       throw new ArgumentOutOfRangeException ();
+
+                               return (PortType) List[index]; 
+                       }
+                        set { List [index] = value; }
+               }
+
+               public PortType this [string name] {
+                       get { 
+                               int index = IndexOf ((PortType) Table[name]);
+                               if (index >= 0)
+                                       return this[index]; 
+                               return null;
+                       }
+               }
+
+               #endregion // Properties
+
+               #region Methods
+
+               public int Add (PortType portType) 
+               {
+                       Insert (Count, portType);       
+                       return (Count - 1);
+               }
+
+               public bool Contains (PortType portType)
+               {
+                       return List.Contains (portType);
+               }
+
+               public void CopyTo (PortType[] array, int index) 
+               {
+                       List.CopyTo (array, index);
+               }
+
+               protected override string GetKey (object value) 
+               {
+                       if (!(value is PortType))
+                               throw new InvalidCastException ();
+                       return ((PortType) value).Name;
+               }
+
+               public int IndexOf (PortType portType)
+               {
+                       return List.IndexOf (portType);
+               }
+
+               public void Insert (int index, PortType portType)
+               {
+                       List.Insert (index, portType);
+               }
+       
+               public void Remove (PortType portType)
+               {
+                       List.Remove (portType);
+               }
+                       
+               protected override void SetParent (object value, object parent)
+               {
+                       ((PortType) value).SetParent ((ServiceDescription) parent); 
+               }
+                       
+               #endregion // Methods
+       }
+}