System.Management.Pash.Implementation.ExecutionVisitor.SetUnderscoreVariable C# (CSharp) Method

SetUnderscoreVariable() private method

private SetUnderscoreVariable ( Exception ex ) : void
ex System.Exception
return void
        private void SetUnderscoreVariable(Exception ex)
        {
            ErrorRecord rec = null;
            if (ex is IContainsErrorRecord)
            {
                rec = ((IContainsErrorRecord)ex).ErrorRecord;
            }
            else
            {
                rec = new ErrorRecord(ex, "", ErrorCategory.InvalidOperation, null);
            }
            ExecutionContext.SetVariable("_", rec);
        }
ExecutionVisitor