private void ProcessParameter(MshParameter p, PSObject inputObject, List <PSNoteProperty> result)
        {
            string        entry             = p.GetEntry("name") as string;
            MshExpression re                = p.GetEntry("expression") as MshExpression;
            List <MshExpressionResult> list = new List <MshExpressionResult>();

            foreach (MshExpression expression2 in re.ResolveNames(inputObject))
            {
                if ((this.exclusionFilter == null) || !this.exclusionFilter.IsMatch(expression2))
                {
                    List <MshExpressionResult> values = expression2.GetValues(inputObject);
                    if (values != null)
                    {
                        foreach (MshExpressionResult result2 in values)
                        {
                            list.Add(result2);
                        }
                    }
                }
            }
            if (list.Count == 0)
            {
                list.Add(new MshExpressionResult(null, re, null));
            }
            else if (!string.IsNullOrEmpty(entry) && (list.Count > 1))
            {
                ErrorRecord errorRecord = new ErrorRecord(new InvalidOperationException(SelectObjectStrings.RenamingMultipleResults), "RenamingMultipleResults", ErrorCategory.InvalidOperation, inputObject);
                base.WriteError(errorRecord);
                return;
            }
            foreach (MshExpressionResult result3 in list)
            {
                if ((this.exclusionFilter == null) || !this.exclusionFilter.IsMatch(result3.ResolvedExpression))
                {
                    PSNoteProperty property;
                    if (string.IsNullOrEmpty(entry))
                    {
                        string str3 = result3.ResolvedExpression.ToString();
                        if (string.IsNullOrEmpty(str3))
                        {
                            PSArgumentException exception = PSTraceSource.NewArgumentException("Property", this.ResourcesBaseName, "EmptyScriptBlockAndNoName", new object[0]);
                            base.ThrowTerminatingError(new ErrorRecord(exception, "EmptyScriptBlockAndNoName", ErrorCategory.InvalidArgument, null));
                        }
                        property = new PSNoteProperty(str3, result3.Result);
                    }
                    else
                    {
                        property = new PSNoteProperty(entry, result3.Result);
                    }
                    result.Add(property);
                }
            }
        }
        private void ProcessExpandParameter(MshParameter p, PSObject inputObject, List <PSNoteProperty> matchedProperties)
        {
            List <MshExpressionResult> values = (p.GetEntry("expression") as MshExpression).GetValues(inputObject);

            if (values.Count == 0)
            {
                ErrorRecord errorRecord = new ErrorRecord(PSTraceSource.NewArgumentException("ExpandProperty", this.ResourcesBaseName, "PropertyNotFound", new object[] { this.expand }), "ExpandPropertyNotFound", ErrorCategory.InvalidArgument, inputObject);
                throw new SelectObjectException(errorRecord);
            }
            if (values.Count > 1)
            {
                ErrorRecord record2 = new ErrorRecord(PSTraceSource.NewArgumentException("ExpandProperty", this.ResourcesBaseName, "MutlipleExpandProperties", new object[] { this.expand }), "MutlipleExpandProperties", ErrorCategory.InvalidArgument, inputObject);
                throw new SelectObjectException(record2);
            }
            MshExpressionResult result = values[0];

            if (result.Exception == null)
            {
                IEnumerable enumerable = LanguagePrimitives.GetEnumerable(result.Result);
                if (enumerable == null)
                {
                    PSObject obj2 = PSObject.AsPSObject(result.Result);
                    this.FilteredWriteObject(obj2, matchedProperties);
                }
                else
                {
                    foreach (object obj3 in enumerable)
                    {
                        if (obj3 != null)
                        {
                            PSObject obj4 = PSObject.AsPSObject(obj3);
                            foreach (PSNoteProperty property in matchedProperties)
                            {
                                try
                                {
                                    if (obj4.Properties[property.Name] != null)
                                    {
                                        this.WriteAlreadyExistingPropertyError(property.Name, inputObject, "AlreadyExistingUserSpecifiedPropertyExpand");
                                    }
                                    else
                                    {
                                        obj4.Properties.Add(property);
                                    }
                                }
                                catch (ExtendedTypeSystemException)
                                {
                                    this.WriteAlreadyExistingPropertyError(property.Name, inputObject, "AlreadyExistingUserSpecifiedPropertyExpand");
                                }
                            }
                            this.FilteredWriteObject(obj4, matchedProperties);
                        }
                    }
                }
            }
            else
            {
                ErrorRecord record3 = new ErrorRecord(result.Exception, "PropertyEvaluationExpand", ErrorCategory.InvalidResult, inputObject);
                throw new SelectObjectException(record3);
            }
        }
        private static void EvaluateSortingExpression(MshParameter p, PSObject inputObject, List <ObjectCommandPropertyValue> orderValues, List <ErrorRecord> errors, out string propertyNotFoundMsg)
        {
            MshExpression entry             = p.GetEntry("expression") as MshExpression;
            List <MshExpressionResult> list = entry.GetValues(inputObject, false, true);

            if (list.Count == 0)
            {
                orderValues.Add(ObjectCommandPropertyValue.NonExistingProperty);
                propertyNotFoundMsg = StringUtil.Format(SortObjectStrings.PropertyNotFound, entry.ToString());
            }
            else
            {
                propertyNotFoundMsg = null;
                foreach (MshExpressionResult result in list)
                {
                    if (result.Exception == null)
                    {
                        orderValues.Add(new ObjectCommandPropertyValue(result.Result));
                    }
                    else
                    {
                        ErrorRecord item = new ErrorRecord(result.Exception, "ExpressionEvaluation", ErrorCategory.InvalidResult, inputObject);
                        errors.Add(item);
                        orderValues.Add(ObjectCommandPropertyValue.ExistingNullProperty);
                    }
                }
            }
        }