internal static bool IsTypeInList(Collection <string> typeNames)
        {
            // NOTE: we do not use inheritance here, since we deal with
            // value types or with types where inheritance is not a factor for the selection
            string typeName = PSObjectHelper.PSObjectIsOfExactType(typeNames);

            if (string.IsNullOrEmpty(typeName))
            {
                return(false);
            }

            string originalTypeName = Deserializer.MaskDeserializationPrefix(typeName);

            if (string.IsNullOrEmpty(originalTypeName))
            {
                return(false);
            }

            // check if the type is derived from a System.Enum
            // e.g. in C#
            // enum Foo { Red, Black, Green}
            if (PSObjectHelper.PSObjectIsEnum(typeNames))
            {
                return(true);
            }

            return(s_defaultScalarTypesHash.Contains(originalTypeName));
        }
示例#2
0
        internal static bool IsTypeInList(Collection <string> typeNames)
        {
            string str = PSObjectHelper.PSObjectIsOfExactType(typeNames);

            if (string.IsNullOrEmpty(str))
            {
                return(false);
            }
            string str2 = Deserializer.MaskDeserializationPrefix(str);

            if (string.IsNullOrEmpty(str2))
            {
                return(false);
            }
            return(PSObjectHelper.PSObjectIsEnum(typeNames) || defaultScalarTypesHash.Contains(str2));
        }