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/ConnectToModuleCollection.cs | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/WixToolset.Core/Link/ConnectToModuleCollection.cs (limited to 'src/WixToolset.Core/Link/ConnectToModuleCollection.cs') diff --git a/src/WixToolset.Core/Link/ConnectToModuleCollection.cs b/src/WixToolset.Core/Link/ConnectToModuleCollection.cs new file mode 100644 index 00000000..6595487f --- /dev/null +++ b/src/WixToolset.Core/Link/ConnectToModuleCollection.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 module objects. + /// + public sealed class ConnectToModuleCollection : ICollection + { + private Hashtable collection; + + /// + /// Instantiate a new ConnectToModuleCollection class. + /// + public ConnectToModuleCollection() + { + this.collection = new Hashtable(); + } + + /// + /// Gets the number of elements actually contained in the ConnectToModuleCollection. + /// + /// The number of elements actually contained in the ConnectToModuleCollection. + public int Count + { + get { return this.collection.Count; } + } + + /// + /// Gets a value indicating whether access to the ConnectToModuleCollection is synchronized (thread-safe). + /// + /// true if access to the ConnectToModuleCollection is synchronized (thread-safe); otherwise, false. The default is false. + public bool IsSynchronized + { + get { return this.collection.IsSynchronized; } + } + + /// + /// Gets an object that can be used to synchronize access to the ConnectToModuleCollection. + /// + /// An object that can be used to synchronize access to the ConnectToModuleCollection. + public object SyncRoot + { + get { return this.collection.SyncRoot; } + } + + /// + /// Gets a module connection by child id. + /// + /// Identifier of child to locate. + public ConnectToModule this[string childId] + { + get { return (ConnectToModule)this.collection[childId]; } + } + + /// + /// Adds a module connection to the collection. + /// + /// Module connection to add. + public void Add(ConnectToModule connection) + { + if (null == connection) + { + throw new ArgumentNullException("connection"); + } + + this.collection.Add(connection.ChildId, connection); + } + + /// + /// Copies the entire ConnectToModuleCollection to a compatible one-dimensional Array, starting at the specified index of the target array. + /// + /// The one-dimensional Array that is the destination of the elements copied from this ConnectToModuleCollection. The Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(System.Array array, int index) + { + this.collection.Keys.CopyTo(array, index); + } + + /// + /// Returns an enumerator for the entire ConnectToModuleCollection. + /// + /// An IEnumerator for the entire ConnectToModuleCollection. + public IEnumerator GetEnumerator() + { + return this.collection.Keys.GetEnumerator(); + } + } +} -- cgit v1.2.3-55-g6feb