private TypeReflector()
 {
     this._nonAttachableMemberCache            = new ThreadSafeDictionary <string, XamlMember>();
     this._nonAttachableMemberCache.IsComplete = true;
     this._attachableMemberCache            = new ThreadSafeDictionary <string, XamlMember>();
     this._attachableMemberCache.IsComplete = true;
     this._baseType.Value                      = XamlLanguage.Object;
     this._boolTypeBits                        = -57015;
     this._collectionKind                      = XamlCollectionKind.None;
     this._addMethod.Value                     = null;
     this._contentProperty.Value               = null;
     this._deferringLoader.Value               = null;
     this._dictionaryKeyProperty.Value         = null;
     this._getEnumeratorMethod.Value           = null;
     this._isReadOnlyMethod.Value              = null;
     this._runtimeNameProperty.Value           = null;
     this._typeConverter.Value                 = null;
     this._uidProperty.Value                   = null;
     this._valueSerializer.Value               = null;
     this._xamlSetMarkupExtensionHandler.Value = null;
     this._xamlSetTypeConverterHandler.Value   = null;
     this._xmlLangProperty.Value               = null;
     base.CustomAttributeProvider              = null;
     this.Invoker = XamlTypeInvoker.UnknownInvoker;
 }
Ejemplo n.º 2
0
        // Used for UnknownReflector only
        private TypeReflector()
        {
            _nonAttachableMemberCache            = new ThreadSafeDictionary <string, XamlMember>();
            _nonAttachableMemberCache.IsComplete = true;
            _attachableMemberCache            = new ThreadSafeDictionary <string, XamlMember>();
            _attachableMemberCache.IsComplete = true;

            _baseType.Value = XamlLanguage.Object;
            _boolTypeBits   = (int)BoolTypeBits.Default | (int)BoolTypeBits.Unknown | (int)BoolTypeBits.WhitespaceSignificantCollection | (int)BoolTypeBits.AllValid;
            _collectionKind = XamlCollectionKind.None;

            // Set all the nullable references explicitly so that IsSet will be equal to true
            _addMethod.Value                     = null;
            _contentProperty.Value               = null;
            _deferringLoader.Value               = null;
            _dictionaryKeyProperty.Value         = null;
            _getEnumeratorMethod.Value           = null;
            _isReadOnlyMethod.Value              = null;
            _runtimeNameProperty.Value           = null;
            _typeConverter.Value                 = null;
            _uidProperty.Value                   = null;
            _valueSerializer.Value               = null;
            _xamlSetMarkupExtensionHandler.Value = null;
            _xamlSetTypeConverterHandler.Value   = null;
            _xmlLangProperty.Value               = null;
            CustomAttributeProvider              = null;

            Invoker = XamlTypeInvoker.UnknownInvoker;
        }
Ejemplo n.º 3
0
        internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collectionKind)
        {
            MethodInfo addMethod = null;

            switch (collectionKind)
            {
            case XamlCollectionKind.Collection:
                if (TryGetCollectionAdder(type, true, out addMethod) && (addMethod == null))
                {
                    throw new XamlSchemaException(System.Xaml.SR.Get("AmbiguousCollectionItemType", new object[] { type }));
                }
                return(addMethod);

            case XamlCollectionKind.Dictionary:
                if (TryGetDictionaryAdder(type, true, out addMethod) && (addMethod == null))
                {
                    throw new XamlSchemaException(System.Xaml.SR.Get("AmbiguousDictionaryItemType", new object[] { type }));
                }
                return(addMethod);
            }
            return(addMethod);
        }
Ejemplo n.º 4
0
        internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collectionKind)
        {
            MethodInfo result = null;

            switch (collectionKind)
            {
            case XamlCollectionKind.Collection:
                bool isCollection = TryGetCollectionAdder(type, true /*mayBeICollection*/, out result);
                if (isCollection && result == null)
                {
                    throw new XamlSchemaException(SR.Get(SRID.AmbiguousCollectionItemType, type));
                }
                break;

            case XamlCollectionKind.Dictionary:
                bool isDictionary = TryGetDictionaryAdder(type, true /*mayBeIDictionary*/, out result);
                if (isDictionary && result == null)
                {
                    throw new XamlSchemaException(SR.Get(SRID.AmbiguousDictionaryItemType, type));
                }
                break;
            }
            return(result);
        }
Ejemplo n.º 5
0
 public TypeReflector(Type underlyingType)
 {
     UnderlyingType  = underlyingType;
     _collectionKind = XamlCollectionKindInvalid;
 }
 public TypeReflector(Type underlyingType)
 {
     this.UnderlyingType  = underlyingType;
     this._collectionKind = (XamlCollectionKind)0xff;
 }
        internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collectionKind)
        {
            MethodInfo addMethod = null;
            switch (collectionKind)
            {
                case XamlCollectionKind.Collection:
                    if (TryGetCollectionAdder(type, true, out addMethod) && (addMethod == null))
                    {
                        throw new XamlSchemaException(System.Xaml.SR.Get("AmbiguousCollectionItemType", new object[] { type }));
                    }
                    return addMethod;

                case XamlCollectionKind.Dictionary:
                    if (TryGetDictionaryAdder(type, true, out addMethod) && (addMethod == null))
                    {
                        throw new XamlSchemaException(System.Xaml.SR.Get("AmbiguousDictionaryItemType", new object[] { type }));
                    }
                    return addMethod;
            }
            return addMethod;
        }