CheckSupported() private method

private CheckSupported ( ) : void
return void
Example #1
0
        internal TypeDesc GetArrayTypeDesc(Type type)
        {
            TypeDesc typeDesc = (TypeDesc)_arrayTypeDescs[type];

            if (typeDesc == null)
            {
                typeDesc = GetTypeDesc(type);
                if (!typeDesc.IsArrayLike)
                {
                    typeDesc = ImportTypeDesc(type, null, false);
                }
                typeDesc.CheckSupported();
                _arrayTypeDescs.Add(type, typeDesc);
            }
            return(typeDesc);
        }
Example #2
0
 internal void CheckSupported()
 {
     if (IsUnsupported)
     {
         if (Exception != null)
         {
             throw Exception;
         }
         else
         {
             throw new NotSupportedException(SR.Format(SR.XmlSerializerUnsupportedType, FullName));
         }
     }
     if (_baseTypeDesc != null)
     {
         _baseTypeDesc.CheckSupported();
     }
     if (_arrayElementTypeDesc != null)
     {
         _arrayElementTypeDesc.CheckSupported();
     }
 }
        internal TypeDesc GetTypeDesc(Type type, MemberInfo source, bool directReference, bool throwOnError)
        {
            if (type.ContainsGenericParameters)
            {
                throw new InvalidOperationException(Res.GetString("XmlUnsupportedOpenGenericType", new object[] { type.ToString() }));
            }
            TypeDesc desc = (TypeDesc)primitiveTypes[type];

            if (desc == null)
            {
                desc = (TypeDesc)this.typeDescs[type];
                if (desc == null)
                {
                    desc = this.ImportTypeDesc(type, source, directReference);
                }
            }
            if (throwOnError)
            {
                desc.CheckSupported();
            }
            return(desc);
        }
Example #4
0
        internal TypeDesc GetTypeDesc(Type type, MemberInfo source, bool directReference, bool throwOnError)
        {
            if (type.GetTypeInfo().ContainsGenericParameters)
            {
                throw new InvalidOperationException(SR.Format(SR.XmlUnsupportedOpenGenericType, type.ToString()));
            }
            TypeDesc typeDesc = (TypeDesc)s_primitiveTypes[type];

            if (typeDesc == null)
            {
                typeDesc = (TypeDesc)_typeDescs[type];
                if (typeDesc == null)
                {
                    typeDesc = ImportTypeDesc(type, source, directReference);
                }
            }
            if (throwOnError)
            {
                typeDesc.CheckSupported();
            }


            return(typeDesc);
        }