| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Configuration; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF.Configuration |
| | | 8 | | { |
| | | 9 | | [ConfigurationCollection(typeof(ServiceNameElement))] |
| | | 10 | | public sealed class ServiceNameElementCollection : ConfigurationElementCollection |
| | | 11 | | { |
| | | 12 | | public ServiceNameElement this[int index] |
| | | 13 | | { |
| | | 14 | | get |
| | | 15 | | { |
| | 0 | 16 | | return (ServiceNameElement)BaseGet(index); |
| | | 17 | | } |
| | | 18 | | set |
| | | 19 | | { |
| | 0 | 20 | | if (BaseGet(index) != null) |
| | | 21 | | { |
| | 0 | 22 | | BaseRemoveAt(index); |
| | | 23 | | } |
| | 0 | 24 | | BaseAdd(index, value); |
| | 0 | 25 | | } |
| | | 26 | | } |
| | | 27 | | |
| | | 28 | | public new ServiceNameElement this[string name] |
| | | 29 | | { |
| | | 30 | | get |
| | | 31 | | { |
| | 0 | 32 | | return (ServiceNameElement)BaseGet(name); |
| | | 33 | | } |
| | | 34 | | set |
| | | 35 | | { |
| | 0 | 36 | | if (BaseGet(name) != null) |
| | | 37 | | { |
| | 0 | 38 | | BaseRemove(name); |
| | | 39 | | } |
| | 0 | 40 | | BaseAdd(value); |
| | 0 | 41 | | } |
| | | 42 | | } |
| | | 43 | | |
| | | 44 | | public void Add(ServiceNameElement element) |
| | | 45 | | { |
| | 0 | 46 | | BaseAdd(element); |
| | 0 | 47 | | } |
| | | 48 | | |
| | | 49 | | public void Clear() |
| | | 50 | | { |
| | 0 | 51 | | BaseClear(); |
| | 0 | 52 | | } |
| | | 53 | | |
| | | 54 | | protected override ConfigurationElement CreateNewElement() |
| | | 55 | | { |
| | 1 | 56 | | return new ServiceNameElement(); |
| | | 57 | | } |
| | | 58 | | |
| | | 59 | | protected override object GetElementKey(ConfigurationElement element) |
| | | 60 | | { |
| | 3 | 61 | | if (element == null) |
| | 0 | 62 | | throw new ArgumentNullException(nameof(element)); |
| | 3 | 63 | | return ((ServiceNameElement)element).Key; |
| | | 64 | | } |
| | | 65 | | |
| | | 66 | | public int IndexOf(ServiceNameElement element) |
| | | 67 | | { |
| | 0 | 68 | | return BaseIndexOf(element); |
| | | 69 | | } |
| | | 70 | | |
| | | 71 | | public void Remove(ServiceNameElement element) |
| | | 72 | | { |
| | 0 | 73 | | if (element == null) |
| | 0 | 74 | | throw new ArgumentNullException(nameof(element)); |
| | 0 | 75 | | BaseRemove(element.Key); |
| | 0 | 76 | | } |
| | | 77 | | |
| | | 78 | | public void Remove(string name) |
| | | 79 | | { |
| | 0 | 80 | | BaseRemove(name); |
| | 0 | 81 | | } |
| | | 82 | | |
| | | 83 | | public void RemoveAt(int index) |
| | | 84 | | { |
| | 0 | 85 | | BaseRemoveAt(index); |
| | 0 | 86 | | } |
| | | 87 | | } |
| | | 88 | | } |