Beispiel #1
0
        /// <summary>
        /// Starts a new Info block with a set of values.
        /// </summary>
        /// <param name="info">The values this Info block represents.</param>
        /// <param name="containerName">Name of the container to write into.</param>
        /// <returns>An <see cref="IDisposable"/> object for use with a using block.</returns>
        public static IDisposable Info(NameValueCollection info, string containerName = null)
        {
            if (containerName == null)
            {
                return(RootContainer.Info(info));
            }
            else
            {
                if (!NamedContainers.TryGetValue(containerName, out var container))
                {
                    container = new RelevantInfoContainer();

                    if (!NamedContainers.TryAdd(containerName, container))
                    {
                        container = NamedContainers[containerName];
                    }
                }

                return(container.Info(info));
            }
        }