diff options
Diffstat (limited to 'src/WixToolset.Core/Link/ConnectToFeatureCollection.cs')
| -rw-r--r-- | src/WixToolset.Core/Link/ConnectToFeatureCollection.cs | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/WixToolset.Core/Link/ConnectToFeatureCollection.cs b/src/WixToolset.Core/Link/ConnectToFeatureCollection.cs new file mode 100644 index 00000000..8dd0d22c --- /dev/null +++ b/src/WixToolset.Core/Link/ConnectToFeatureCollection.cs | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Link | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections; | ||
| 7 | |||
| 8 | /// <summary> | ||
| 9 | /// Hash collection of connect to feature objects. | ||
| 10 | /// </summary> | ||
| 11 | public sealed class ConnectToFeatureCollection : ICollection | ||
| 12 | { | ||
| 13 | private Hashtable collection; | ||
| 14 | |||
| 15 | /// <summary> | ||
| 16 | /// Instantiate a new ConnectToFeatureCollection class. | ||
| 17 | /// </summary> | ||
| 18 | public ConnectToFeatureCollection() | ||
| 19 | { | ||
| 20 | this.collection = new Hashtable(); | ||
| 21 | } | ||
| 22 | |||
| 23 | /// <summary> | ||
| 24 | /// Gets the number of items in the collection. | ||
| 25 | /// </summary> | ||
| 26 | /// <value>Number of items in collection.</value> | ||
| 27 | public int Count | ||
| 28 | { | ||
| 29 | get { return this.collection.Count; } | ||
| 30 | } | ||
| 31 | |||
| 32 | /// <summary> | ||
| 33 | /// Gets if the collection has been synchronized. | ||
| 34 | /// </summary> | ||
| 35 | /// <value>True if the collection has been synchronized.</value> | ||
| 36 | public bool IsSynchronized | ||
| 37 | { | ||
| 38 | get { return this.collection.IsSynchronized; } | ||
| 39 | } | ||
| 40 | |||
| 41 | /// <summary> | ||
| 42 | /// Gets the object used to synchronize the collection. | ||
| 43 | /// </summary> | ||
| 44 | /// <value>Oject used the synchronize the collection.</value> | ||
| 45 | public object SyncRoot | ||
| 46 | { | ||
| 47 | get { return this.collection.SyncRoot; } | ||
| 48 | } | ||
| 49 | |||
| 50 | /// <summary> | ||
| 51 | /// Gets a feature connection by child id. | ||
| 52 | /// </summary> | ||
| 53 | /// <param name="childId">Identifier of child to locate.</param> | ||
| 54 | public ConnectToFeature this[string childId] | ||
| 55 | { | ||
| 56 | get { return (ConnectToFeature)this.collection[childId]; } | ||
| 57 | } | ||
| 58 | |||
| 59 | /// <summary> | ||
| 60 | /// Adds a feature connection to the collection. | ||
| 61 | /// </summary> | ||
| 62 | /// <param name="connection">Feature connection to add.</param> | ||
| 63 | public void Add(ConnectToFeature connection) | ||
| 64 | { | ||
| 65 | if (null == connection) | ||
| 66 | { | ||
| 67 | throw new ArgumentNullException("connection"); | ||
| 68 | } | ||
| 69 | |||
| 70 | this.collection.Add(connection.ChildId, connection); | ||
| 71 | } | ||
| 72 | |||
| 73 | /// <summary> | ||
| 74 | /// Copies the collection into an array. | ||
| 75 | /// </summary> | ||
| 76 | /// <param name="array">Array to copy the collection into.</param> | ||
| 77 | /// <param name="index">Index to start copying from.</param> | ||
| 78 | public void CopyTo(System.Array array, int index) | ||
| 79 | { | ||
| 80 | this.collection.CopyTo(array, index); | ||
| 81 | } | ||
| 82 | |||
| 83 | /// <summary> | ||
| 84 | /// Gets enumerator for the collection. | ||
| 85 | /// </summary> | ||
| 86 | /// <returns>Enumerator for the collection.</returns> | ||
| 87 | public IEnumerator GetEnumerator() | ||
| 88 | { | ||
| 89 | return this.collection.Values.GetEnumerator(); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | } | ||
