Ejemplo n.º 1
0
        private XamlType TryGetXamlType(string typeName)
        {
            // Look up the type in our cache. If it's there, we're done.
            XamlType xamlType;

            if (_typeCache.TryGetValue(typeName, out xamlType))
            {
                return(xamlType);
            }

            // Otherwise, look up the type via reflection
            Type type = TryGetType(typeName);

            if (type == null)
            {
                return(null);
            }

            // And save it in our cache
            xamlType = SchemaContext.GetXamlType(type);
            if (xamlType != null)
            {
                xamlType = XamlSchemaContext.TryAdd(_typeCache, typeName, xamlType);
            }
            return(xamlType);
        }
Ejemplo n.º 2
0
        private XamlType TryGetXamlType(string typeName)
        {
            XamlType xamlType;

            if (!this._typeCache.TryGetValue(typeName, out xamlType))
            {
                Type type2 = this.TryGetType(typeName);
                if (type2 == null)
                {
                    return(null);
                }
                xamlType = this.SchemaContext.GetXamlType(type2);
                if (xamlType != null)
                {
                    xamlType = XamlSchemaContext.TryAdd <string, XamlType>(this._typeCache, typeName, xamlType);
                }
            }
            return(xamlType);
        }