/********************************************************************++ Copyright (c) Microsoft Corporation. All rights reserved. --********************************************************************/ using System; namespace System.Management.Automation { /// /// A variable that represents $? /// internal class QuestionMarkVariable : PSVariable { /// /// Constructs an instance of the variable with execution context. /// /// /// /// Execution context /// internal QuestionMarkVariable (ExecutionContext context) : base(SpecialVariables.Question, true, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope, RunspaceInit.DollarHookDescription) { _context = context; } private readonly ExecutionContext _context; /// /// Gets or sets the value of the variable. /// /// public override object Value { get { DebuggerCheckVariableRead(); return _context.QuestionMarkVariableValue; } set { // Call base's setter to force an error (because the variable is readonly). base.Value = value; } } } }