mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-18 05:05:36 +00:00
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
/********************************************************************++
|
|||
|
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
--********************************************************************/
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
using System;
|
||
|
|
|
||
|
|
namespace System.Management.Automation
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// A variable that represents $?
|
||
|
|
/// </summary>
|
||
|
|
internal class QuestionMarkVariable : PSVariable
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Constructs an instance of the variable with execution context.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
/// <param name="context">
|
||
|
|
/// Execution context
|
||
|
|
/// </param>
|
||
|
|
internal QuestionMarkVariable (ExecutionContext context)
|
||
|
|
: base(SpecialVariables.Question, true, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope, RunspaceInit.DollarHookDescription)
|
||
|
|
{
|
||
|
|
_context = context;
|
||
|
|
}
|
||
|
|
|
||
|
|
private readonly ExecutionContext _context;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Gets or sets the value of the variable.
|
||
|
|
/// </summary>
|
||
|
|
///
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|