System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping C# (CSharp) Method

ImportTypeMapping() public method

public ImportTypeMapping ( Type type, XmlRootAttribute root, string defaultNamespace ) : XmlTypeMapping
type System.Type
root XmlRootAttribute
defaultNamespace string
return XmlTypeMapping
        public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute root, string defaultNamespace)
        {
            if (type == null)
                throw new ArgumentNullException(nameof(type));
            XmlTypeMapping xmlMapping = new XmlTypeMapping(_typeScope, ImportElement(_modelScope.GetTypeModel(type), root, defaultNamespace, new RecursionLimiter()));
            xmlMapping.SetKeyInternal(XmlMapping.GenerateKey(type, root, defaultNamespace));
            xmlMapping.GenerateSerializer = true;
            return xmlMapping;
        }

Same methods

XmlReflectionImporter::ImportTypeMapping ( TypeModel model, string ns, ImportContext context, string dataType, XmlAttributes a, RecursionLimiter limiter ) : TypeMapping
XmlReflectionImporter::ImportTypeMapping ( TypeModel model, string ns, ImportContext context, string dataType, XmlAttributes a, bool repeats, bool openModel, RecursionLimiter limiter ) : TypeMapping
XmlReflectionImporter::ImportTypeMapping ( Type type ) : XmlTypeMapping
XmlReflectionImporter::ImportTypeMapping ( Type type, XmlRootAttribute root ) : XmlTypeMapping
XmlReflectionImporter::ImportTypeMapping ( Type type, string defaultNamespace ) : XmlTypeMapping

Usage Example

Beispiel #1
0
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace) {
     XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
     for (int i = 0; i < extraTypes.Length; i++)
         importer.IncludeType(extraTypes[i]);
     tempAssembly = GenerateTempAssembly(importer.ImportTypeMapping(type, root));
     this.events.sender = this;
 }
All Usage Examples Of System.Xml.Serialization.XmlReflectionImporter::ImportTypeMapping