Windows-powershell / PowerShell-master /src /Microsoft.PowerShell.Commands.Utility /commands /utility /FormatAndOutput /OutGridView /ExpressionColumnInfo.cs
Download PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs
-
curl -L -o ExpressionColumnInfo.cs https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/ExpressionColumnInfo.cs
1.19 kB
| // 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()); | |
| } | |
| } | |
| } | |