/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/System.Management.Automation/namespaces/StackInfo.cs
61 строка
2 KB
Dongbo Wang
Revert "Use `is null` syntax (#13277)" (#13322)
31 июл 2020, 02:06
Не верифицирован
31 июл 2020, 02:06
4b9b078
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; namespace System.Management.Automation { /// <summary> /// An object that represents a stack of paths. /// </summary> public sealed class PathInfoStack : Stack<PathInfo> { /// <summary> /// Constructor for the PathInfoStack class. /// </summary> /// <param name="stackName"> /// The name of the stack. /// </param> /// <param name="locationStack"> /// A stack object containing PathInfo objects /// </param> /// <exception cref="ArgumentNullException"> /// If <paramref name="locationStack"/> is null. /// </exception> /// <exception cref="ArgumentException"> /// If <paramref name="stackName"/> is null or empty. /// </exception> internal PathInfoStack(string stackName, Stack<PathInfo> locationStack) : base() { if (locationStack == null) { throw PSTraceSource.NewArgumentNullException(nameof(locationStack)); } if (string.IsNullOrEmpty(stackName)) { throw PSTraceSource.NewArgumentException(nameof(stackName)); } Name = stackName; // Since the Stack<T> constructor takes an IEnumerable and // not a Stack<T> the stack actually gets enumerated in the // wrong order. I have to push them on manually in the // appropriate order. PathInfo[] stackContents = new PathInfo[locationStack.Count]; locationStack.CopyTo(stackContents, 0); for (int index = stackContents.Length - 1; index >= 0; --index) { this.Push(stackContents[index]); } } /// <summary> /// Gets the name of the stack. /// </summary> public string Name { get; } = null; } }