• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Serialization.TypeMapping类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Serialization.TypeMapping的典型用法代码示例。如果您正苦于以下问题:C# TypeMapping类的具体用法?C# TypeMapping怎么用?C# TypeMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypeMapping类属于System.Xml.Serialization命名空间,在下文中一共展示了TypeMapping类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WriteQualifiedNameElement

        void WriteQualifiedNameElement(string name, string ns, object defaultValue, SourceInfo source, bool nullable, TypeMapping mapping) {
            bool hasDefault = defaultValue != null && defaultValue != DBNull.Value;
            if (hasDefault) {
                throw CodeGenerator.NotSupported("XmlQualifiedName DefaultValue not supported.  Fail in WriteValue()");
            }
            List<Type> argTypes = new List<Type>();
            ilg.Ldarg(0);
            ilg.Ldstr(name);
            argTypes.Add(typeof(string));
            if (ns != null) {
                ilg.Ldstr(ns);
                argTypes.Add(typeof(string));
            }
            source.Load(mapping.TypeDesc.Type);
            argTypes.Add(mapping.TypeDesc.Type);

            MethodInfo XmlSerializationWriter_WriteXXX = typeof(XmlSerializationWriter).GetMethod(
                 nullable ? ("WriteNullableQualifiedNameLiteral") : "WriteElementQualifiedName",
                 CodeGenerator.InstanceBindingFlags,
                 null,
                 argTypes.ToArray(),
                 null
                 );
            ilg.Call(XmlSerializationWriter_WriteXXX);

            if (hasDefault) {
                throw CodeGenerator.NotSupported("XmlQualifiedName DefaultValue not supported.  Fail in WriteValue()");
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:29,代码来源:XmlSerializationWriterILGen.cs


示例2: ExportType

        void ExportType(TypeMapping mapping) {
            if (mapping.IsReference)
                return;
            if (ExportedMappings[mapping] == null) {
                CodeTypeDeclaration codeClass = null;
                ExportedMappings.Add(mapping, mapping);
                if (mapping is EnumMapping) {
                    codeClass = ExportEnum((EnumMapping)mapping, typeof(SoapEnumAttribute));
                }
                else if (mapping is StructMapping) {
                    codeClass = ExportStruct((StructMapping)mapping);
                }
                else if (mapping is ArrayMapping) {
                    EnsureTypesExported(((ArrayMapping)mapping).Elements, null);
                }
                if (codeClass != null) {
                    // Add [GeneratedCodeAttribute(Tool=.., Version=..)]
                    codeClass.CustomAttributes.Add(GeneratedCodeAttribute);

                    // Add [SerializableAttribute]
                    codeClass.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(SerializableAttribute).FullName));

                    if (!codeClass.IsEnum) {
                        // Add [DebuggerStepThrough]
                        codeClass.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(DebuggerStepThroughAttribute).FullName));
                        // Add [DesignerCategory("code")]
                        codeClass.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(DesignerCategoryAttribute).FullName, new CodeAttributeArgument[] {new CodeAttributeArgument(new CodePrimitiveExpression("code"))}));
                    }
                    AddTypeMetadata(codeClass.CustomAttributes, typeof(SoapTypeAttribute), mapping.TypeDesc.Name, Accessor.UnescapeName(mapping.TypeName), mapping.Namespace, mapping.IncludeInSchema);
                    ExportedClasses.Add(mapping, codeClass);
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:33,代码来源:SoapCodeExporter.cs


示例3: ReferenceMapping

 internal string ReferenceMapping(TypeMapping mapping)
 {
     if (!mapping.IsSoap)
     {
         if (_generatedMethods[mapping] == null)
         {
             _referencedMethods = EnsureArrayIndex(_referencedMethods, _references);
             _referencedMethods[_references++] = mapping;
         }
     }
     return (string)_methodNames[mapping];
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:12,代码来源:XmlSerializationGeneratedCode.cs


示例4: GenerateMethod

        internal override void GenerateMethod(TypeMapping mapping) {
            if (GeneratedMethods.Contains(mapping))
                return;

            GeneratedMethods[mapping] = mapping;
            if (mapping is StructMapping) {
                WriteStructMethod((StructMapping)mapping);
            }
            else if (mapping is EnumMapping) {
                WriteEnumMethod((EnumMapping)mapping);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:XmlSerializationWriterILGen.cs


示例5: EnsureArrayIndex

 private TypeMapping[] EnsureArrayIndex(TypeMapping[] a, int index)
 {
     if (a == null)
     {
         return new TypeMapping[0x20];
     }
     if (index < a.Length)
     {
         return a;
     }
     TypeMapping[] destinationArray = new TypeMapping[a.Length + 0x20];
     Array.Copy(a, destinationArray, index);
     return destinationArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:XmlSerializationCodeGen.cs


示例6: GenerateMethod

        internal override void GenerateMethod(TypeMapping mapping)
        {
            if (!GeneratedMethods.Add(mapping))
                return;

            if (mapping is StructMapping)
            {
                WriteStructMethod((StructMapping)mapping);
            }
            else if (mapping is EnumMapping)
            {
                WriteEnumMethod((EnumMapping)mapping);
            }
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:14,代码来源:XmlSerializationWriterILGen.cs


示例7: WriteCreateMapping

        void WriteCreateMapping(TypeMapping mapping, string local) {
            string fullTypeName = mapping.TypeDesc.CSharpName;
            bool useReflection = mapping.TypeDesc.UseReflection;
            bool ctorInaccessible = mapping.TypeDesc.CannotNew;

            Writer.Write(useReflection ? "object" : fullTypeName);
            Writer.Write(" ");
            Writer.Write(local);
            Writer.WriteLine(";");

            if (ctorInaccessible) {
                Writer.WriteLine("try {");
                Writer.Indent++;
            }
            Writer.Write(local);
            Writer.Write(" = ");
            Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.TypeDesc.CannotNew, true));
            Writer.WriteLine(";");
            if (ctorInaccessible) {
                WriteCatchException(typeof(MissingMethodException));
                Writer.Indent++;
                Writer.Write("throw CreateInaccessibleConstructorException(");
                WriteQuotedCSharpString(fullTypeName);
                Writer.WriteLine(");");

                WriteCatchException(typeof(SecurityException));
                Writer.Indent++;

                Writer.Write("throw CreateCtorHasSecurityException(");
                WriteQuotedCSharpString(fullTypeName);
                Writer.WriteLine(");");

                Writer.Indent--;
                Writer.WriteLine("}");
            }
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:36,代码来源:XmlSerializationReader.cs


示例8: ReferenceMapping

 internal string ReferenceMapping(TypeMapping mapping)
 {
     if (!_generatedMethods.Contains(mapping))
     {
         _referencedMethods = EnsureArrayIndex(_referencedMethods, _references);
         _referencedMethods[_references++] = mapping;
     }
     string methodName;
     _methodNames.TryGetValue(mapping, out methodName);
     return methodName;
 }
开发者ID:omariom,项目名称:corefx,代码行数:11,代码来源:XmlSerializationILGen.cs


示例9: WritePrimitive

 void WritePrimitive(TypeMapping mapping, string source) {
     if (mapping is EnumMapping) {
         string enumMethodName = ReferenceMapping(mapping);
         if (enumMethodName == null) throw new InvalidOperationException(Res.GetString(Res.XmlMissingMethodEnum, mapping.TypeDesc.Name));
         if (mapping.IsSoap) {
             // SOAP methods are not strongly-typed (the return object), so we need to add a cast
             Writer.Write("(");
             Writer.Write(mapping.TypeDesc.CSharpName);
             Writer.Write(")");
         }
         Writer.Write(enumMethodName);
         Writer.Write("(");
         if (!mapping.IsSoap) Writer.Write(source);
         Writer.Write(")");
     }
     else if (mapping.TypeDesc == StringTypeDesc) {
         Writer.Write(source);
     }
     else if (mapping.TypeDesc.FormatterName == "String") {
         if (mapping.TypeDesc.CollapseWhitespace) {
             Writer.Write("CollapseWhitespace(");
             Writer.Write(source);
             Writer.Write(")");
         }
         else {
             Writer.Write(source);
         }
     }
     else {
         if (!mapping.TypeDesc.HasCustomFormatter) {
             Writer.Write(typeof(XmlConvert).FullName);
             Writer.Write(".");
         }
         Writer.Write("To");
         Writer.Write(mapping.TypeDesc.FormatterName);
         Writer.Write("(");
         Writer.Write(source);
         Writer.Write(")");
     }
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:40,代码来源:XmlSerializationReader.cs


示例10: CreateElementAccessor

 static ElementAccessor CreateElementAccessor(TypeMapping mapping, string ns) {
     ElementAccessor element = new ElementAccessor();
     if (mapping.TypeDesc.Kind == TypeKind.Node) {
         element.Any = true;
     }
     else {
         element.Name = Accessor.EscapeName(mapping.TypeName, false);
         element.Namespace = ns;
     }
     element.Mapping = mapping;
     return element;
 }
开发者ID:ArildF,项目名称:masters,代码行数:12,代码来源:xmlreflectionimporter.cs


示例11: ExportDefaultValue

 internal static string ExportDefaultValue(TypeMapping mapping, object value)
 {
     if (!(mapping is PrimitiveMapping))
     {
         return null;
     }
     if ((value == null) || (value == DBNull.Value))
     {
         return null;
     }
     if (mapping is EnumMapping)
     {
         EnumMapping mapping2 = (EnumMapping) mapping;
         ConstantMapping[] constants = mapping2.Constants;
         if (mapping2.IsFlags)
         {
             string[] vals = new string[constants.Length];
             long[] ids = new long[constants.Length];
             Hashtable hashtable = new Hashtable();
             for (int j = 0; j < constants.Length; j++)
             {
                 vals[j] = constants[j].XmlName;
                 ids[j] = ((int) 1) << j;
                 hashtable.Add(constants[j].Name, ids[j]);
             }
             long val = XmlCustomFormatter.ToEnum((string) value, hashtable, mapping2.TypeName, false);
             if (val == 0L)
             {
                 return null;
             }
             return XmlCustomFormatter.FromEnum(val, vals, ids, mapping.TypeDesc.FullName);
         }
         for (int i = 0; i < constants.Length; i++)
         {
             if (constants[i].Name == ((string) value))
             {
                 return constants[i].XmlName;
             }
         }
         return null;
     }
     PrimitiveMapping mapping3 = (PrimitiveMapping) mapping;
     if (!mapping3.TypeDesc.HasCustomFormatter)
     {
         if (mapping3.TypeDesc.FormatterName == "String")
         {
             return (string) value;
         }
         Type type = typeof(XmlConvert);
         MethodInfo method = type.GetMethod("ToString", new Type[] { mapping3.TypeDesc.Type });
         if (method != null)
         {
             return (string) method.Invoke(type, new object[] { value });
         }
     }
     else
     {
         string str = XmlCustomFormatter.FromDefaultValue(value, mapping3.TypeDesc.FormatterName);
         if (str == null)
         {
             throw new InvalidOperationException(Res.GetString("XmlInvalidDefaultValue", new object[] { value.ToString(), mapping3.TypeDesc.Name }));
         }
         return str;
     }
     throw new InvalidOperationException(Res.GetString("XmlInvalidDefaultValue", new object[] { value.ToString(), mapping3.TypeDesc.Name }));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:66,代码来源:XmlSchemaExporter.cs


示例12: CreateElementAccessor

 static ElementAccessor CreateElementAccessor(TypeMapping mapping, string ns) {
     ElementAccessor element = new ElementAccessor();
     bool isAny = mapping.TypeDesc.Kind == TypeKind.Node;
     if (!isAny && mapping is SerializableMapping) {
         isAny = ((SerializableMapping)mapping).IsAny;
     }
     if (isAny) {
         element.Any = true;
     }
     else {
         element.Name = mapping.DefaultElementName;
         element.Namespace = ns;
     }
     element.Mapping = mapping;
     return element;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:16,代码来源:xmlreflectionimporter.cs


示例13: WritePrimitive

        void WritePrimitive(string method, string name, string ns, object defaultValue, string source, TypeMapping mapping, bool writeXsiType, bool isElement, bool isNullable) {
            TypeDesc typeDesc = mapping.TypeDesc;
            bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.TypeDesc.HasDefaultSupport;
            if (hasDefault) {
                if (mapping is EnumMapping) {
                    #if DEBUG
                        // use exception in the place of Debug.Assert to avoid throwing asserts from a server process such as aspnet_ewp.exe
                        if (defaultValue.GetType() != typeof(string)) throw new InvalidOperationException(Res.GetString(Res.XmlInternalErrorDetails, name + " has invalid default type " + defaultValue.GetType().Name));
                    #endif

                    Writer.Write("if (");
                    if (mapping.TypeDesc.UseReflection)
                        Writer.Write(RaCodeGen.GetStringForEnumLongValue(source, mapping.TypeDesc.UseReflection));
                    else
                        Writer.Write(source);
                    Writer.Write(" != ");
                    if (((EnumMapping)mapping).IsFlags) {
                        Writer.Write("(");
                        string[] values = ((string)defaultValue).Split(null);
                        for (int i = 0; i < values.Length; i++) {
                            if (values[i] == null || values[i].Length == 0) 
                                continue;
                            if (i > 0) 
                                Writer.WriteLine(" | ");
                            Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.TypeDesc.UseReflection));
                        }
                        Writer.Write(")");
                    }
                    else {
                        Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue, mapping.TypeDesc.UseReflection));
                    }
                    Writer.Write(")");
                }
                else {
                    WriteCheckDefault(source, defaultValue, isNullable);
                }
                Writer.WriteLine(" {");
                Writer.Indent++;
            }
            Writer.Write(method);
            Writer.Write("(");
            WriteQuotedCSharpString(name);
            if (ns != null) {
                Writer.Write(", ");
                WriteQuotedCSharpString(ns);
            }
            Writer.Write(", ");

            if (mapping is EnumMapping) {
                WriteEnumValue((EnumMapping)mapping, source);
            }
            else {
                WritePrimitiveValue(typeDesc, source, isElement);
            }

            if (writeXsiType) {
                Writer.Write(", new System.Xml.XmlQualifiedName(");
                WriteQuotedCSharpString(mapping.TypeName);
                Writer.Write(", ");
                WriteQuotedCSharpString(mapping.Namespace);
                Writer.Write(")");
            }

            Writer.WriteLine(");");

            if (hasDefault) {
                Writer.Indent--;
                Writer.WriteLine("}");
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:70,代码来源:XmlSerializationWriter.cs


示例14: ReferenceMapping

 internal string ReferenceMapping(TypeMapping mapping)
 {
     if (!mapping.IsSoap && (this.generatedMethods[mapping] == null))
     {
         this.referencedMethods = this.EnsureArrayIndex(this.referencedMethods, this.references);
         this.referencedMethods[this.references++] = mapping;
     }
     return (string) this.methodNames[mapping];
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XmlSerializationCodeGen.cs


示例15: GenerateMethod

 internal virtual void GenerateMethod(TypeMapping mapping){}
开发者ID:uQr,项目名称:referencesource,代码行数:1,代码来源:XmlSerializationGeneratedCode.cs


示例16: WritePrimitive

        private void WritePrimitive(WritePrimitiveMethodRequirement method, string name, string ns, object defaultValue, object o, TypeMapping mapping, bool writeXsiType, bool isElement, bool isNullable)
        {
            TypeDesc typeDesc = mapping.TypeDesc;
            bool hasDefault = defaultValue != null && !Globals.IsDBNullValue(defaultValue) && mapping.TypeDesc.HasDefaultSupport;
            if (hasDefault)
            {
                if (mapping is EnumMapping)
                {
                    if (((EnumMapping)mapping).IsFlags)
                    {
                        var defaultEnumFlagValues = defaultValue.ToString().Split(null).Where((s) => !string.IsNullOrWhiteSpace(s));
                        string defaultEnumFlagString = string.Join(", ", defaultEnumFlagValues);

                        if (o.ToString() == defaultEnumFlagString)
                            return;
                    }
                    else
                    {
                        if (o.ToString() == defaultValue.ToString())
                            return;
                    }
                }
                else
                {
                    if (IsDefaultValue(mapping, o, defaultValue, isNullable))
                    {
                        return;
                    }
                }
            }

            XmlQualifiedName xmlQualifiedName = null;
            if (writeXsiType)
            {
                xmlQualifiedName = new XmlQualifiedName(mapping.TypeName, mapping.Namespace);
            }

            string stringValue = null;
            bool hasValidStringValue = false;
            if (mapping is EnumMapping)
            {
                stringValue = WriteEnumMethod((EnumMapping)mapping, o);
                hasValidStringValue = true;
            }
            else
            {
                hasValidStringValue = WritePrimitiveValue(typeDesc, o, isElement, out stringValue);
            }

            if (hasValidStringValue)
            {
                if (hasRequirement(method, WritePrimitiveMethodRequirement.WriteElementString))
                {
                    if (hasRequirement(method, WritePrimitiveMethodRequirement.Raw))
                    {
                        WriteElementString(name, ns, stringValue, xmlQualifiedName);
                    }
                    else
                    {
                        WriteElementStringRaw(name, ns, stringValue, xmlQualifiedName);
                    }
                }

                else if (hasRequirement(method, WritePrimitiveMethodRequirement.WriteNullableStringLiteral))
                {
                    if (hasRequirement(method, WritePrimitiveMethodRequirement.Raw))
                    {
                        WriteNullableStringLiteral(name, ns, stringValue);
                    }
                    else
                    {
                        WriteNullableStringLiteralRaw(name, ns, stringValue);
                    }
                }
                else if (hasRequirement(method, WritePrimitiveMethodRequirement.WriteAttribute))
                {
                    WriteAttribute(name, ns, stringValue);
                }
                else
                {
                    // #10593: Add More Tests for Serialization Code
                    Debug.Assert(false);
                }
            }
            else if (o is byte[])
            {
                byte[] a = (byte[])o;
                if (hasRequirement(method, WritePrimitiveMethodRequirement.WriteElementString | WritePrimitiveMethodRequirement.Raw))
                {
                    WriteElementStringRaw(name, ns, FromByteArrayBase64(a));
                }
                else if (hasRequirement(method, WritePrimitiveMethodRequirement.WriteNullableStringLiteral | WritePrimitiveMethodRequirement.Raw))
                {
                    WriteNullableStringLiteralRaw(name, ns, FromByteArrayBase64(a));
                }
                else if (hasRequirement(method, WritePrimitiveMethodRequirement.WriteAttribute))
                {
                    WriteAttribute(name, ns, a);
                }
                else
//.........这里部分代码省略.........
开发者ID:geoffkizer,项目名称:corefx,代码行数:101,代码来源:ReflectionXmlSerializationWriter.cs


示例17: IsDefaultValue

 private bool IsDefaultValue(TypeMapping mapping, object o, object value, bool isNullable)
 {
     if (value is string && ((string)value).Length == 0)
     {
         string str = (string)o;
         return str == null || str.Length == 0;
     }
     else
     {
         return value.Equals(o);
     }
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:12,代码来源:ReflectionXmlSerializationWriter.cs


示例18: ReferenceMapping

 internal string ReferenceMapping(TypeMapping mapping) {
     if (generatedMethods[mapping] == null) {
         referencedMethods = EnsureArrayIndex(referencedMethods, references);
         referencedMethods[references++] = mapping;
     }
     return (string)methodNames[mapping];
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:XmlSerializationILGen.cs


示例19: ExportDefaultValue

        static internal string ExportDefaultValue(TypeMapping mapping, object value) {
            
            if (!(mapping is PrimitiveMapping))
                // should throw, but it will be a breaking change;
                return null;

            if (value == null || value == DBNull.Value)
                return null;

            if (mapping is EnumMapping) {
                EnumMapping em = (EnumMapping)mapping;

                #if DEBUG
                    // use exception in the place of Debug.Assert to avoid throwing asserts from a server process such as aspnet_ewp.exe
                    if (value.GetType() != typeof(string)) throw new InvalidOperationException(Res.GetString(Res.XmlInternalErrorDetails, Res.GetString(Res.XmlInvalidDefaultValue, value.ToString(), value.GetType().FullName)));
                #endif

                // check the validity of the value
                ConstantMapping[] c = em.Constants;
                if (em.IsFlags) {
                    string[] names = new string[c.Length];
                    long[] ids = new long[c.Length];
                    Hashtable values = new Hashtable();
                    for (int i = 0; i < c.Length; i++) {
                        names[i] = c[i].XmlName;
                        ids[i] = 1 << i;
                        values.Add(c[i].Name, ids[i]);
                    }
                    long val = XmlCustomFormatter.ToEnum((string)value, values, em.TypeName, false);
                    return val != 0 ? XmlCustomFormatter.FromEnum(val, names, ids, mapping.TypeDesc.FullName) : null;
                }
                else {
                    for (int i = 0; i < c.Length; i++) {
                        if (c[i].Name == (string)value) {
                            return c[i].XmlName;
                        }
                    }
                    return null; // unknown value
                }
            }
            
            PrimitiveMapping pm = (PrimitiveMapping)mapping;

            if (!pm.TypeDesc.HasCustomFormatter) {

                #if DEBUG
                    // use exception in the place of Debug.Assert to avoid throwing asserts from a server process such as aspnet_ewp.exe
                    if (pm.TypeDesc.Type == null) {
                        throw new InvalidOperationException(Res.GetString(Res.XmlInternalErrorDetails, "Mapping for " + pm.TypeDesc.Name + " missing type property"));
                    }
                #endif

                if (pm.TypeDesc.FormatterName == "String")
                    return (string)value;

                Type formatter = typeof(XmlConvert);
                System.Reflection.MethodInfo format = formatter.GetMethod("ToString", new Type[] { pm.TypeDesc.Type });
                if (format != null)
                    return (string)format.Invoke(formatter, new Object[] {value});
            }
            else {
                string defaultValue = XmlCustomFormatter.FromDefaultValue(value, pm.TypeDesc.FormatterName);
                if (defaultValue == null)
                    throw new InvalidOperationException(Res.GetString(Res.XmlInvalidDefaultValue, value.ToString(), pm.TypeDesc.Name));
                return defaultValue;
            }
            throw new InvalidOperationException(Res.GetString(Res.XmlInvalidDefaultValue, value.ToString(), pm.TypeDesc.Name));
        }
开发者ID:uQr,项目名称:referencesource,代码行数:68,代码来源:XmlSchemaExporter.cs


示例20: CheckForDuplicateType

        void CheckForDuplicateType(TypeMapping mapping, string newNamespace) {
            if (mapping.IsAnonymousType)
                return;
            string newTypeName = mapping.TypeName;
            XmlSchema schema = schemas[newNamespace];
            if (schema != null){
                foreach (XmlSchemaObject o in schema.Items) {
                    XmlSchemaType type = o as XmlSchemaType;
                    if ( type != null && type.Name == newTypeName)
                        throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateTypeName, newTypeName, newNamespace));

                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:XmlSchemaExporter.cs



注:本文中的System.Xml.Serialization.TypeMapping类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.TypeScope类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.TypeDesc类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap