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


C# MemberMapping.GetTypeName方法代碼示例

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


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

示例1: ExportProperty

        void ExportProperty(CodeTypeDeclaration codeClass, MemberMapping member, CodeIdentifiers memberScope) {
            string fieldName = memberScope.AddUnique(CodeExporter.MakeFieldName(member.Name), member);
            string fieldType = member.GetTypeName(CodeProvider);
            // need to create a private field
            CodeMemberField field = new CodeMemberField(fieldType, fieldName);
            field.Attributes = MemberAttributes.Private;
            codeClass.Members.Add(field);

            CodeMemberProperty prop = CreatePropertyDeclaration(field, member.Name, fieldType);
            prop.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
            AddMemberMetadata(prop.CustomAttributes, member, false);
            codeClass.Members.Add(prop);

            if (member.CheckSpecified != SpecifiedAccessor.None) {
                field = new CodeMemberField(typeof(bool).FullName, fieldName + "Specified");
                field.Attributes = MemberAttributes.Private;
                codeClass.Members.Add(field);
                
                prop = CreatePropertyDeclaration(field, member.Name + "Specified", typeof(bool).FullName);
                prop.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
                prop.CustomAttributes.Add(attribute);
                codeClass.Members.Add(prop);
            }
        }
開發者ID:uQr,項目名稱:referencesource,代碼行數:25,代碼來源:SoapCodeExporter.cs

示例2: ExportProperty

 private void ExportProperty(CodeTypeDeclaration codeClass, MemberMapping member, CodeIdentifiers memberScope)
 {
     string name = memberScope.AddUnique(CodeExporter.MakeFieldName(member.Name), member);
     string typeName = member.GetTypeName(base.CodeProvider);
     CodeMemberField field = new CodeMemberField(typeName, name) {
         Attributes = MemberAttributes.Private
     };
     codeClass.Members.Add(field);
     CodeMemberProperty property = base.CreatePropertyDeclaration(field, member.Name, typeName);
     property.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
     this.AddMemberMetadata(property.CustomAttributes, member, false);
     codeClass.Members.Add(property);
     if (member.CheckSpecified != SpecifiedAccessor.None)
     {
         field = new CodeMemberField(typeof(bool).FullName, name + "Specified") {
             Attributes = MemberAttributes.Private
         };
         codeClass.Members.Add(field);
         property = base.CreatePropertyDeclaration(field, member.Name + "Specified", typeof(bool).FullName);
         property.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
         CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
         property.CustomAttributes.Add(declaration);
         codeClass.Members.Add(property);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:25,代碼來源:SoapCodeExporter.cs

示例3: ExportMember

        void ExportMember(CodeTypeDeclaration codeClass, MemberMapping member) {
            string fieldType = member.GetTypeName(CodeProvider);
            CodeMemberField field = new CodeMemberField(fieldType, member.Name);
            field.Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
            field.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
            codeClass.Members.Add(field);
            AddMemberMetadata(field.CustomAttributes, member, false);

            if (member.CheckSpecified != SpecifiedAccessor.None) {
                field = new CodeMemberField(typeof(bool).FullName, member.Name + "Specified");
                field.Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
                field.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
                field.CustomAttributes.Add(attribute);
                codeClass.Members.Add(field);
            }
        }
開發者ID:uQr,項目名稱:referencesource,代碼行數:17,代碼來源:SoapCodeExporter.cs

示例4: ExportMember

 private void ExportMember(CodeTypeDeclaration codeClass, MemberMapping member, string ns, CodeConstructor ctor)
 {
     CodeMemberField field;
     field = new CodeMemberField(member.GetTypeName(base.CodeProvider), member.Name) {
         Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public
     };
     field.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
     codeClass.Members.Add(field);
     this.AddMemberMetadata(field, field.CustomAttributes, member, ns, false, field.Comments, ctor);
     if (member.CheckSpecified != SpecifiedAccessor.None)
     {
         field = new CodeMemberField(typeof(bool).FullName, member.Name + "Specified") {
             Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public
         };
         field.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
         CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(XmlIgnoreAttribute).FullName);
         field.CustomAttributes.Add(declaration);
         codeClass.Members.Add(field);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:20,代碼來源:XmlCodeExporter.cs


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