private EnumerableExpansion GetExpansionState(PSObject so)
        {
            if ((this.parameters != null) && this.parameters.expansion.HasValue)
            {
                return(this.parameters.expansion.Value);
            }
            ConsolidatedString internalTypeNames = so.InternalTypeNames;

            return(DisplayDataQuery.GetEnumerableExpansionFromType(this.expressionFactory, this._typeInfoDataBase, internalTypeNames));
        }
        private EnumerableExpansion GetExpansionState(PSObject so)
        {
            // if the command line swtich has been specified, use this as an override
            if (_parameters != null && _parameters.expansion.HasValue)
            {
                return(_parameters.expansion.Value);
            }

            // check if we have an expansion entry in format.mshxml
            var typeNames = so.InternalTypeNames;

            return(DisplayDataQuery.GetEnumerableExpansionFromType(
                       _expressionFactory, _typeInfoDataBase, typeNames));
        }
        internal static EnumerableExpansion GetEnumerableExpansionFromType(
            MshExpressionFactory expressionFactory,
            TypeInfoDataBase db,
            Collection <string> typeNames)
        {
            TypeMatch typeMatch = new TypeMatch(expressionFactory, db, typeNames);

            foreach (EnumerableExpansionDirective expansionDirective in db.defaultSettingsSection.enumerableExpansionDirectiveList)
            {
                if (typeMatch.PerfectMatch(new TypeMatchItem((object)expansionDirective, expansionDirective.appliesTo)))
                {
                    return(expansionDirective.enumerableExpansion);
                }
            }
            if (typeMatch.BestMatch != null)
            {
                return(((EnumerableExpansionDirective)typeMatch.BestMatch).enumerableExpansion);
            }
            Collection <string> typeNames1 = Deserializer.MaskDeserializationPrefix(typeNames);

            return(typeNames1 != null?DisplayDataQuery.GetEnumerableExpansionFromType(expressionFactory, db, typeNames1) : EnumerableExpansion.EnumOnly);
        }