// 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.Core.Link { using System; using System.Collections; /// /// Hash collection of connect to module objects. /// internal 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(); } } }