Esempio n. 1
0
        // ======================================================

        private Type TryGetType(string typeName)
        {
            Type type = SearchAssembliesForShortName(typeName);

            if (type == null && IsClrNamespace)
            {
                Debug.Assert(_assemblyNamespaces.Count == 1);
                type = XamlLanguage.LookupClrNamespaceType(_assemblyNamespaces[0], typeName);
            }
            if (type == null)
            {
                return(null);
            }

            // Discard private nested types
            Type currentType = type;

            while (currentType.IsNested)
            {
                if (currentType.IsNestedPrivate)
                {
                    return(null);
                }
                currentType = currentType.DeclaringType;
            }
            return(type);
        }
Esempio n. 2
0
        private Type TryGetType(string typeName)
        {
            Type clrNamespaceType = this.SearchAssembliesForShortName(typeName);

            if ((clrNamespaceType == null) && this.IsClrNamespace)
            {
                clrNamespaceType = XamlLanguage.LookupClrNamespaceType(this._assemblyNamespaces[0], typeName);
            }
            if (clrNamespaceType == null)
            {
                return(null);
            }
            for (Type type2 = clrNamespaceType; type2.IsNested; type2 = type2.DeclaringType)
            {
                if (type2.IsNestedPrivate)
                {
                    return(null);
                }
            }
            return(clrNamespaceType);
        }