/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs
39 строк
1 KB
xtqqczze
Seal internal types in `Microsoft.PowerShell.Commands.Utility` (#25892)
25 авг 2025, 08:22
Не верифицирован
25 авг 2025, 08:22
5b72eb5
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; using System.Management.Automation; namespace Microsoft.PowerShell.Commands { internal sealed class ExpressionColumnInfo : ColumnInfo { private readonly PSPropertyExpression _expression; internal ExpressionColumnInfo(string staleObjectPropertyName, string displayName, PSPropertyExpression expression) : base(staleObjectPropertyName, displayName) { _expression = expression; } internal override object GetValue(PSObject liveObject) { List<PSPropertyExpressionResult> resList = _expression.GetValues(liveObject); if (resList.Count == 0) { return null; } // Only first element is used. PSPropertyExpressionResult result = resList[0]; if (result.Exception != null) { return null; } object objectResult = result.Result; return objectResult == null ? string.Empty : ColumnInfo.LimitString(objectResult.ToString()); } } }