Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
QuestionMarkVariable.cs44 linesDownload Raw Back to engine
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4namespace System.Management.Automation5{6    /// <summary>7    /// A variable that represents $?8    /// </summary>9    internal class QuestionMarkVariable : PSVariable10    {11        /// <summary>12        /// Constructs an instance of the variable with execution context.13        /// </summary>14        /// <param name="context">15        /// Execution context16        /// </param>17        internal QuestionMarkVariable(ExecutionContext context)18            : base(SpecialVariables.Question, true, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope, RunspaceInit.DollarHookDescription)19        {20            _context = context;21        }22 23        private readonly ExecutionContext _context;24 25        /// <summary>26        /// Gets or sets the value of the variable.27        /// </summary>28        public override object Value29        {30            get31            {32                DebuggerCheckVariableRead();33                return _context.QuestionMarkVariableValue;34            }35 36            set37            {38                // Call base's setter to force an error (because the variable is readonly).39                base.Value = value;40            }41        }42    }43}44