當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlReflectionImporter.IncludeType方法代碼示例

本文整理匯總了C#中System.Xml.Serialization.XmlReflectionImporter.IncludeType方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlReflectionImporter.IncludeType方法的具體用法?C# XmlReflectionImporter.IncludeType怎麽用?C# XmlReflectionImporter.IncludeType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Serialization.XmlReflectionImporter的用法示例。


在下文中一共展示了XmlReflectionImporter.IncludeType方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: XmlSerializer

 /// <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;
 }
開發者ID:ArildF,項目名稱:masters,代碼行數:11,代碼來源:xmlserializer.cs

示例2: GetLiteralTypeMapping

		XmlTypeMapping GetLiteralTypeMapping ()
		{
			XmlRootAttribute root = new XmlRootAttribute("rootroot");
			Type[] types = new Type[] {typeof(UknTestPart), typeof(AnotherTestPart), typeof(DblStringContainer) };
			XmlReflectionImporter ri = new XmlReflectionImporter ();
			foreach (Type t in types) ri.IncludeType (t);
			return ri.ImportTypeMapping (typeof(Test), root);
		}
開發者ID:carrie901,項目名稱:mono,代碼行數:8,代碼來源:ComplexDataStructure.cs

示例3: TestIncludeType

		[Test] // bug #76049
		public void TestIncludeType ()
		{
			XmlReflectionImporter imp = new XmlReflectionImporter ();
			XmlTypeMapping map = imp.ImportTypeMapping (typeof (object));
			imp.IncludeType (typeof (TestSpace));
			XmlSerializer ser = new XmlSerializer (map);
			ser.Serialize (new StringWriter (), new TestSpace ());
		}
開發者ID:frje,項目名稱:SharpLang,代碼行數:9,代碼來源:XmlSerializerTests.cs

示例4: Init

        private void Init(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, object location, object evidence)
        {
            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 !NET_NATIVE
            _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace);
#endif
        }
開發者ID:SamuelEnglard,項目名稱:corefx,代碼行數:19,代碼來源:XmlSerializer.cs

示例5: XmlSerializer

		public XmlSerializer (Type type,
			XmlAttributeOverrides overrides,
			Type [] extraTypes,
			XmlRootAttribute root,
			string defaultNamespace)
		{
			if (type == null)
				throw new ArgumentNullException ("type");

			XmlReflectionImporter importer = new XmlReflectionImporter (overrides, defaultNamespace);

			if (extraTypes != null) 
			{
				foreach (Type intype in extraTypes)
					importer.IncludeType (intype);
			}

			typeMapping = importer.ImportTypeMapping (type, root, defaultNamespace);
		}
開發者ID:ItsVeryWindy,項目名稱:mono,代碼行數:19,代碼來源:XmlSerializer.cs

示例6: CreateSerializer

        internal XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (location != null || evidence != null)
            {
                DemandForUserLocationOrEvidence();
            }

            XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
            for (int i = 0; i < extraTypes.Length; i++)
                importer.IncludeType(extraTypes[i]);
            XmlTypeMapping mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
            TempAssembly tempAssembly = XmlSerializer.GenerateTempAssembly(mapping, type, defaultNamespace, location, evidence);
            return (XmlSerializer)tempAssembly.Contract.TypedSerializers[mapping.Key];
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:19,代碼來源:XmlSerializerFactory.cs

示例7: XmlSerializer

        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer7"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        internal XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, object location, object evidence)
        {
#if NET_NATIVE
            throw new PlatformNotSupportedException();
#else
            if (type == null)
                throw new ArgumentNullException("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);
            _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace);
#endif
        }
開發者ID:er0dr1guez,項目名稱:corefx,代碼行數:22,代碼來源:XmlSerializer.cs

示例8: GetSerializer

		XmlSerializer GetSerializer (MessageBodyDescription desc)
		{
			if (bodySerializers.ContainsKey (desc))
				return bodySerializers [desc];

			int count = desc.Parts.Count + (HasReturnValue (desc) ? 1 : 0);
			XmlReflectionMember [] members = new XmlReflectionMember [count];

			int ind = 0;
			if (HasReturnValue (desc))
				members [ind++] = CreateReflectionMember (desc.ReturnValue, true);

			foreach (MessagePartDescription partDesc in desc.Parts)
				members [ind++] = CreateReflectionMember (partDesc, false);

			XmlReflectionImporter xmlImporter = new XmlReflectionImporter ();
			// Register known types into xmlImporter.
			foreach (var type in OperationKnownTypes)
				xmlImporter.IncludeType (type);
			XmlMembersMapping [] partsMapping = new XmlMembersMapping [1];
			partsMapping [0] = xmlImporter.ImportMembersMapping (desc.WrapperName, desc.WrapperNamespace, members, true);
			bodySerializers [desc] = XmlSerializer.FromMappings (partsMapping) [0];
			return bodySerializers [desc];
		}
開發者ID:nekresh,項目名稱:mono,代碼行數:24,代碼來源:BaseMessagesFormatter.cs

示例9: XmlSerializer

 public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence) {
     if (type == null)
         throw new ArgumentNullException("type");
     XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
     for (int i = 0; i < extraTypes.Length; i++)
         importer.IncludeType(extraTypes[i]);
     this.mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
     tempAssembly = GenerateTempAssembly(this.mapping, type, defaultNamespace, location, evidence);
 }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:9,代碼來源:xmlserializer.cs

示例10: XmlSerializer

        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer7"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        internal XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
        {
            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 || evidence != null)
            {
                DemandForUserLocationOrEvidence();
            }

#if !NET_NATIVE
            _tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location, evidence);
#endif
        }
開發者ID:alessandromontividiu03,項目名稱:corefx,代碼行數:27,代碼來源:XmlSerializer.cs

示例11: XmlSerializer

 public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
 {
     this.events = new XmlDeserializationEvents();
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
     if (extraTypes != null)
     {
         for (int i = 0; i < extraTypes.Length; i++)
         {
             importer.IncludeType(extraTypes[i]);
         }
     }
     this.mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
     if (location != null)
     {
         this.DemandForUserLocation();
     }
     this.tempAssembly = GenerateTempAssembly(this.mapping, type, defaultNamespace, location, evidence);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:22,代碼來源:XmlSerializer.cs

示例12: CreateSerializer

 public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
     for (int i = 0; i < extraTypes.Length; i++)
     {
         importer.IncludeType(extraTypes[i]);
     }
     XmlTypeMapping xmlMapping = importer.ImportTypeMapping(type, root, defaultNamespace);
     return (XmlSerializer) XmlSerializer.GenerateTempAssembly(xmlMapping, type, defaultNamespace, location, evidence).Contract.TypedSerializers[xmlMapping.Key];
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:14,代碼來源:XmlSerializerFactory.cs


注:本文中的System.Xml.Serialization.XmlReflectionImporter.IncludeType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。