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

C# Serialization.TypeScope类代码示例

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

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



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

示例1: XmlMapping

 internal XmlMapping(TypeScope scope, ElementAccessor accessor, XmlMappingAccess access)
 {
     _scope = scope;
     _accessor = accessor;
     _access = access;
     _shallow = scope == null;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:XmlMapping.cs


示例2: XmlMembersMapping

 internal XmlMembersMapping(TypeScope scope, ElementAccessor accessor) : base(scope) {
     this.accessor = accessor;
     MembersMapping mapping = (MembersMapping)accessor.Mapping;
     mappings = new XmlMemberMapping[mapping.Members.Length];
     for (int i = 0; i < mappings.Length; i++)
         mappings[i] = new XmlMemberMapping(scope, mapping.Members[i]);
 }
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:xmlmembersmapping.cs


示例3: XmlMapping

 internal XmlMapping(TypeScope scope, ElementAccessor accessor, XmlMappingAccess access)
 {
     this.scope = scope;
     this.accessor = accessor;
     this.access = access;
     this.shallow = scope == null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:XmlMapping.cs


示例4: CheckScope

 void CheckScope(TypeScope scope) {
     if (this.scope == null) {
         this.scope = scope;
     }
     else if (this.scope != scope) {
         throw new InvalidOperationException(Res.GetString(Res.XmlMappingsScopeMismatch));
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:soapcodeexporter.cs


示例5: SoapReflectionImporter

 /// <include file='doc\SoapReflectionImporter.uex' path='docs/doc[@for="SoapReflectionImporter.SoapReflectionImporter3"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapReflectionImporter(SoapAttributeOverrides attributeOverrides, string defaultNamespace) {
     if (defaultNamespace == null)
         defaultNamespace = String.Empty;
     if (attributeOverrides == null)
         attributeOverrides = new SoapAttributeOverrides();
     this.attributeOverrides = attributeOverrides;
     this.defaultNs = defaultNamespace;
     this.typeScope = new TypeScope();
     this.modelScope = new ModelScope(this.typeScope);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:14,代码来源:soapreflectionimporter.cs


示例6: CheckScope

 private void CheckScope(TypeScope scope)
 {
     if (_scope == null)
     {
         _scope = scope;
     }
     else if (_scope != scope)
     {
         throw new InvalidOperationException(SR.XmlMappingsScopeMismatch);
     }
 }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:11,代码来源:SoapSchemaExporter.cs


示例7: XmlSerializationILGen

 internal XmlSerializationILGen(TypeScope[] scopes, string access, string className) {
     this.scopes = scopes;
     if (scopes.Length > 0) {
         stringTypeDesc = scopes[0].GetTypeDesc(typeof(string));
         qnameTypeDesc = scopes[0].GetTypeDesc(typeof(XmlQualifiedName));
     }
     this.raCodeGen = new ReflectionAwareILGen();
     this.className = className;
     System.Diagnostics.Debug.Assert(access == "public");
     this.typeAttributes = TypeAttributes.Public;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:XmlSerializationILGen.cs


示例8: XmlReflectionImporter

 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public XmlReflectionImporter(XmlAttributeOverrides attributeOverrides, string defaultNamespace)
 {
     if (defaultNamespace == null)
         defaultNamespace = String.Empty;
     if (attributeOverrides == null)
         attributeOverrides = new XmlAttributeOverrides();
     _attributeOverrides = attributeOverrides;
     _defaultNs = defaultNamespace;
     _typeScope = new TypeScope();
     _modelScope = new ModelScope(_typeScope);
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:14,代码来源:XmlReflectionImporter.cs


示例9: XmlSerializationCodeGen

 internal XmlSerializationCodeGen(IndentedWriter writer, TypeScope[] scopes, string access, string className) {
     this.writer = writer;
     this.scopes = scopes;
     if (scopes.Length > 0) {
         stringTypeDesc = scopes[0].GetTypeDesc(typeof(string));
         qnameTypeDesc = scopes[0].GetTypeDesc(typeof(XmlQualifiedName));
     }
     this.raCodeGen = new ReflectionAwareCodeGen(writer);
     this.className = className;
     this.access = access;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:XmlSerializationGeneratedCode.cs


示例10: XmlMembersMapping

 internal XmlMembersMapping(TypeScope scope, ElementAccessor accessor, XmlMappingAccess access) : base(scope, accessor, access) {
     MembersMapping mapping = (MembersMapping)accessor.Mapping;
     StringBuilder key = new StringBuilder();
     key.Append(":");
     mappings = new XmlMemberMapping[mapping.Members.Length];
     for (int i = 0; i < mappings.Length; i++) {
         if (mapping.Members[i].TypeDesc.Type != null) {
             key.Append(GenerateKey(mapping.Members[i].TypeDesc.Type, null, null));
             key.Append(":");
         }
         mappings[i] = new XmlMemberMapping(mapping.Members[i]);
     }
     SetKeyInternal(key.ToString());
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:XmlMembersMapping.cs


示例11: XmlReflectionImporter

 public XmlReflectionImporter(XmlAttributeOverrides attributeOverrides, string defaultNamespace)
 {
     this.defaultAttributes = new XmlAttributes();
     this.types = new System.Xml.Serialization.NameTable();
     this.nullables = new System.Xml.Serialization.NameTable();
     this.elements = new System.Xml.Serialization.NameTable();
     this.anonymous = new Hashtable();
     this.choiceNum = 1;
     if (defaultNamespace == null)
     {
         defaultNamespace = string.Empty;
     }
     if (attributeOverrides == null)
     {
         attributeOverrides = new XmlAttributeOverrides();
     }
     this.attributeOverrides = attributeOverrides;
     this.defaultNs = defaultNamespace;
     this.typeScope = new TypeScope();
     this.modelScope = new ModelScope(this.typeScope);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:XmlReflectionImporter.cs


示例12: XmlTypeMapping

 internal XmlTypeMapping(TypeScope scope, ElementAccessor accessor) : base(scope, accessor) { 
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:2,代码来源:xmltypemapping.cs


示例13: XmlMapping

 internal XmlMapping(TypeScope scope, ElementAccessor accessor) : this(scope, accessor, XmlMappingAccess.Read | XmlMappingAccess.Write){
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:2,代码来源:XmlMapping.cs


示例14: GenerateAssembly

        internal static Assembly GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, string defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies) {
            FileIOPermission.Assert();
            for (int i = 0; i < xmlMappings.Length; i++) {
                xmlMappings[i].CheckShallow();
            }
            Compiler compiler = new Compiler();
            try {
                Hashtable scopeTable = new Hashtable();
                foreach (XmlMapping mapping in xmlMappings)
                    scopeTable[mapping.Scope] = mapping;
                TypeScope[] scopes = new TypeScope[scopeTable.Keys.Count];
                scopeTable.Keys.CopyTo(scopes, 0);
                
                assemblies.Clear();
                Hashtable importedTypes = new Hashtable();
                foreach (TypeScope scope in scopes) {
                    foreach (Type t in scope.Types) {
                        compiler.AddImport(t, importedTypes);
                        Assembly a = t.Assembly;
                        string name = a.FullName;
                        if (assemblies[name] != null)
                            continue;
                        if (!a.GlobalAssemblyCache) {
                            assemblies[name] = a;
                        }
                    }
                }
                for (int i = 0; i < types.Length; i++) {
                    compiler.AddImport(types[i], importedTypes);
                }
                compiler.AddImport(typeof(object).Assembly);
                compiler.AddImport(typeof(XmlSerializer).Assembly);

                IndentedWriter writer = new IndentedWriter(compiler.Source, false);
                
                writer.WriteLine("#if _DYNAMIC_XMLSERIALIZER_COMPILATION");
                writer.WriteLine("[assembly:System.Security.AllowPartiallyTrustedCallers()]");
                writer.WriteLine("[assembly:System.Security.SecurityTransparent()]");
                writer.WriteLine("#endif");
                // Add AssemblyVersion attribute to match parent accembly version
                if (types != null && types.Length > 0 && types[0] != null) {
                    writer.WriteLine("[assembly:System.Reflection.AssemblyVersionAttribute(\"" + types[0].Assembly.GetName().Version.ToString() + "\")]");
                }
                if (assembly != null && types.Length > 0) {
                    for (int i = 0; i < types.Length; i++) {
                        Type type = types[i];
                        if (type == null)
                            continue;
                        if (DynamicAssemblies.IsTypeDynamic(type)) {
                            throw new InvalidOperationException(Res.GetString(Res.XmlPregenTypeDynamic, types[i].FullName));
                        }
                    }
                    writer.Write("[assembly:");
                    writer.Write(typeof(XmlSerializerVersionAttribute).FullName);
                    writer.Write("(");
                    writer.Write("ParentAssemblyId=");
                    ReflectionAwareCodeGen.WriteQuotedCSharpString(writer, GenerateAssemblyId(types[0]));
                    writer.Write(", Version=");
                    ReflectionAwareCodeGen.WriteQuotedCSharpString(writer, ThisAssembly.Version);
                    if (defaultNamespace != null) {
                        writer.Write(", Namespace=");
                        ReflectionAwareCodeGen.WriteQuotedCSharpString(writer, defaultNamespace);
                    }
                    writer.WriteLine(")]");
                }
                CodeIdentifiers classes = new CodeIdentifiers();
                classes.AddUnique("XmlSerializationWriter", "XmlSerializationWriter");
                classes.AddUnique("XmlSerializationReader", "XmlSerializationReader");
                string suffix = null;
                if (types != null && types.Length == 1 && types[0] != null) {
                    suffix = CodeIdentifier.MakeValid(types[0].Name);
                    if (types[0].IsArray) {
                        suffix += "Array";
                    }
                }

                writer.WriteLine("namespace " + GeneratedAssemblyNamespace + " {");
                writer.Indent++;

                writer.WriteLine();

                string writerClass = "XmlSerializationWriter" + suffix;
                writerClass = classes.AddUnique(writerClass, writerClass);
                XmlSerializationWriterCodeGen writerCodeGen = new XmlSerializationWriterCodeGen(writer, scopes, "public", writerClass);

                writerCodeGen.GenerateBegin();
                string[] writeMethodNames = new string[xmlMappings.Length];

                for (int i = 0; i < xmlMappings.Length; i++) {
                    writeMethodNames[i] = writerCodeGen.GenerateElement(xmlMappings[i]);
                }
                writerCodeGen.GenerateEnd();
                    
                writer.WriteLine();

                string readerClass = "XmlSerializationReader" + suffix;
                readerClass = classes.AddUnique(readerClass, readerClass);
                XmlSerializationReaderCodeGen readerCodeGen = new XmlSerializationReaderCodeGen(writer, scopes, "public", readerClass);

                readerCodeGen.GenerateBegin();
//.........这里部分代码省略.........
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:101,代码来源:compilation.cs


示例15: ExportRootIfNecessary

 private void ExportRootIfNecessary(TypeScope typeScope)
 {
     if (this.needToExportRoot)
     {
         foreach (TypeMapping mapping in typeScope.TypeMappings)
         {
             if ((mapping is StructMapping) && mapping.TypeDesc.IsRoot)
             {
                 this.ExportDerivedMappings((StructMapping) mapping);
             }
             else if (mapping is ArrayMapping)
             {
                 this.ExportArrayMapping((ArrayMapping) mapping, mapping.Namespace, null);
             }
             else if (mapping is SerializableMapping)
             {
                 this.ExportSpecialMapping((SerializableMapping) mapping, mapping.Namespace, false, null);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:XmlSchemaExporter.cs


示例16: XmlTypeMapping

 internal XmlTypeMapping(TypeScope scope, ElementAccessor accessor) : base(scope) { 
     this.accessor = accessor;
 }
开发者ID:ArildF,项目名称:masters,代码行数:3,代码来源:xmltypemapping.cs


示例17: XmlSerializationWriterCodeGen

 internal XmlSerializationWriterCodeGen(IndentedWriter writer, TypeScope[] scopes, string access, string className) : base(writer, scopes, access, className){
 }
开发者ID:uQr,项目名称:referencesource,代码行数:2,代码来源:XmlSerializationWriter.cs


示例18: ModelScope

 internal ModelScope(TypeScope typeScope)
 {
     _typeScope = typeScope;
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:4,代码来源:Models.cs


示例19: XmlSerializationReaderCodeGen

 public XmlSerializationReaderCodeGen(IndentedWriter writer, TypeScope[] scopes, string access, string className) : this(writer, scopes){
     this.className = className;
     this.access = access;
 }
开发者ID:ArildF,项目名称:masters,代码行数:4,代码来源:xmlserializationreader.cs


示例20: WriteTypeInfo

        string WriteTypeInfo(TypeScope scope, TypeDesc typeDesc, Type type){
            InitTheFirstTime();
            string typeFullName = typeDesc.CSharpName;
            string typeVariable = (string)reflectionVariables[typeFullName];
            if (typeVariable != null)
                return typeVariable;

            if (type.IsArray)
            {
                typeVariable = GenerateVariableName("array", typeDesc.CSharpName);
                TypeDesc elementTypeDesc = typeDesc.ArrayElementTypeDesc;
                if (elementTypeDesc.UseReflection)
                {
                    string elementTypeVariable = WriteTypeInfo(scope, elementTypeDesc, scope.GetTypeFromTypeDesc(elementTypeDesc));
                    writer.WriteLine("static "+typeof(Type).FullName+" "+typeVariable +" = " + elementTypeVariable + ".MakeArrayType();");
                }
                else
                {
                    string assemblyVariable = WriteAssemblyInfo(type);
                    writer.Write("static "+typeof(Type).FullName+" "+typeVariable +" = "+assemblyVariable+".GetType(");
                    WriteQuotedCSharpString(type.FullName);
                    writer.WriteLine(");");
                }
            }
            else
            {
                typeVariable = GenerateVariableName("type", typeDesc.CSharpName);

                Type parameterType = Nullable.GetUnderlyingType(type);
                if (parameterType != null)
                {
                    string parameterTypeVariable = WriteTypeInfo(scope, scope.GetTypeDesc(parameterType), parameterType);
                    writer.WriteLine("static "+typeof(Type).FullName+" "+typeVariable +" = typeof(System.Nullable<>).MakeGenericType(new " + typeof(Type).FullName + "[] {"+parameterTypeVariable+"});");
                }
                else
                {
                    string assemblyVariable = WriteAssemblyInfo(type);
                    writer.Write("static "+typeof(Type).FullName+" "+typeVariable +" = "+assemblyVariable+".GetType(");
                    WriteQuotedCSharpString(type.FullName);
                    writer.WriteLine(");");
                }
            }
            
            reflectionVariables.Add(typeFullName, typeVariable);

            TypeMapping mapping = scope.GetTypeMappingFromTypeDesc(typeDesc);
            if (mapping != null)
                WriteMappingInfo(mapping, typeVariable, type);
            if (typeDesc.IsCollection || typeDesc.IsEnumerable){// Arrays use the generic item_Array
                TypeDesc elementTypeDesc = typeDesc.ArrayElementTypeDesc;
                if (elementTypeDesc.UseReflection)
                    WriteTypeInfo(scope, elementTypeDesc, scope.GetTypeFromTypeDesc(elementTypeDesc));
                WriteCollectionInfo(typeVariable, typeDesc, type);
            }
            return typeVariable;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:56,代码来源:XmlSerializationWriter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.XmlAttributeOverrides类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.TypeMapping类代码示例发布时间: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