From d3d3649a68cb1fa589fdd987a6690dbd5d671f0d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 17 Sep 2017 15:35:20 -0700 Subject: Initial code commit --- .../Link/ConnectToFeatureCollection.cs | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/WixToolset.Core/Link/ConnectToFeatureCollection.cs (limited to 'src/WixToolset.Core/Link/ConnectToFeatureCollection.cs') 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 @@ +// 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. + +namespace WixToolset.Link +{ + using System; + using System.Collections; + + /// + /// Hash collection of connect to feature objects. + /// + public sealed class ConnectToFeatureCollection : ICollection + { + private Hashtable collection; + + /// + /// Instantiate a new ConnectToFeatureCollection class. + /// + public ConnectToFeatureCollection() + { + this.collection = new Hashtable(); + } + + /// + /// Gets the number of items in the collection. + /// + /// Number of items in collection. + public int Count + { + get { return this.collection.Count; } + } + + /// + /// Gets if the collection has been synchronized. + /// + /// True if the collection has been synchronized. + public bool IsSynchronized + { + get { return this.collection.IsSynchronized; } + } + + /// + /// Gets the object used to synchronize the collection. + /// + /// Oject used the synchronize the collection. + public object SyncRoot + { + get { return this.collection.SyncRoot; } + } + + /// + /// Gets a feature connection by child id. + /// + /// Identifier of child to locate. + public ConnectToFeature this[string childId] + { + get { return (ConnectToFeature)this.collection[childId]; } + } + + /// + /// Adds a feature connection to the collection. + /// + /// Feature connection to add. + public void Add(ConnectToFeature connection) + { + if (null == connection) + { + throw new ArgumentNullException("connection"); + } + + this.collection.Add(connection.ChildId, connection); + } + + /// + /// Copies the collection into an array. + /// + /// Array to copy the collection into. + /// Index to start copying from. + public void CopyTo(System.Array array, int index) + { + this.collection.CopyTo(array, index); + } + + /// + /// Gets enumerator for the collection. + /// + /// Enumerator for the collection. + public IEnumerator GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } + } +} -- cgit v1.2.3-55-g6feb