System.Xml.Serialization.XmlReflectionImporter.IncludeType C# (CSharp) 메소드

IncludeType() 개인적인 메소드

private IncludeType ( Type type, RecursionLimiter limiter ) : void
type System.Type
limiter RecursionLimiter
리턴 void
        private void IncludeType(Type type, RecursionLimiter limiter)
        {
            int previousNestingLevel = _arrayNestingLevel;
            XmlArrayItemAttributes previousArrayItemAttributes = _savedArrayItemAttributes;
            string previousArrayNamespace = _savedArrayNamespace;
            _arrayNestingLevel = 0;
            _savedArrayItemAttributes = null;
            _savedArrayNamespace = null;

            TypeMapping mapping = ImportTypeMapping(_modelScope.GetTypeModel(type), _defaultNs, ImportContext.Element, string.Empty, null, limiter);
            if (mapping.IsAnonymousType && !mapping.TypeDesc.IsSpecial)
            {
                //XmlAnonymousInclude=Cannot include anonymous type '{0}'.
                throw new InvalidOperationException(SR.Format(SR.XmlAnonymousInclude, type.FullName));
            }
            _arrayNestingLevel = previousNestingLevel;
            _savedArrayItemAttributes = previousArrayItemAttributes;
            _savedArrayNamespace = previousArrayNamespace;
        }

Same methods

XmlReflectionImporter::IncludeType ( Type type ) : void

Usage Example

예제 #1
0
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer7"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            DefaultNamespace = defaultNamespace;
            rootType         = type;
            XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);

            if (extraTypes != null)
            {
                for (int i = 0; i < extraTypes.Length; i++)
                {
                    importer.IncludeType(extraTypes[i]);
                }
            }
            _mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
            if (location != null)
            {
                DemandForUserLocationOrEvidence();
            }

#if !NET_NATIVE
            _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location);
#endif
        }
All Usage Examples Of System.Xml.Serialization.XmlReflectionImporter::IncludeType