// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; using System.Management.Automation.Runspaces; namespace System.Management.Automation { /// /// Repository of remote runspaces available in a local runspace. /// public class RunspaceRepository : Repository { #region Public Methods /// /// Collection of runspaces available. /// public List Runspaces { get { return Items; } } #endregion Public Methods #region Internal Methods /// /// Internal constructor. /// internal RunspaceRepository() : base("runspace") { } /// /// Gets a key for the specified item. /// /// /// protected override Guid GetKey(PSSession item) { if (item != null) { return item.InstanceId; } return Guid.Empty; } /// /// Adds the PSSession item to the repository if it doesn't already /// exist or replaces the existing one. /// /// PSSession object. internal void AddOrReplace(PSSession item) { this.Dictionary[GetKey(item)] = item; } #endregion Private Methods } }