/// <summary> /// Gets the values of the object properties matched by this expression. /// </summary> /// <param name="target">The object to match against.</param> /// <param name="expand">If the matched properties are parameter sets, expand them.</param> /// <param name="eatExceptions">If true, any exceptions that occur during the match process are ignored.</param> public List <PSPropertyExpressionResult> GetValues(PSObject target, bool expand, bool eatExceptions) { List <PSPropertyExpressionResult> retVal = new List <PSPropertyExpressionResult>(); // If the object passed in is a hashtable, then turn it into a PSCustomObject so // that property expressions can work on it. target = IfHashtableWrapAsPSCustomObject(target); // process the script case if (Script != null) { PSPropertyExpression scriptExpression = new PSPropertyExpression(Script); PSPropertyExpressionResult r = scriptExpression.GetValue(target, eatExceptions); retVal.Add(r); return(retVal); } // process the expression List <PSPropertyExpression> resolvedExpressionList = this.ResolveNames(target, expand); foreach (PSPropertyExpression re in resolvedExpressionList) { PSPropertyExpressionResult r = re.GetValue(target, eatExceptions); retVal.Add(r); } return(retVal); }
/// <summary> /// Gets the values of the object properties matched by this expression. /// </summary> /// <param name="target">The object to match against.</param> /// <param name="expand">If the matched properties are parameter sets, expand them.</param> /// <param name="eatExceptions">If true, any exceptions that occur during the match process are ignored.</param> public List <PSPropertyExpressionResult> GetValues(PSObject target, bool expand, bool eatExceptions) { List <PSPropertyExpressionResult> retVal = new List <PSPropertyExpressionResult>(); // process the script case if (Script != null) { PSPropertyExpression scriptExpression = new PSPropertyExpression(Script); PSPropertyExpressionResult r = scriptExpression.GetValue(target, eatExceptions); retVal.Add(r); return(retVal); } foreach (PSPropertyExpression resolvedName in ResolveNames(target, expand)) { PSPropertyExpressionResult result = resolvedName.GetValue(target, eatExceptions); retVal.Add(result); } return(retVal); }