xml反序列化时 如何生成与之对应的类文件

作者:xiaotie  来源:网络  【打印此文】【
>   /**//// <remarks/>
   [System.Xml.Serialization.XmlAttributeAttribute()]
   public string Url {
   get {
   return this.urlField;
   }
   set {
   this.urlField = value;
   }
   }
   }
  
   /**//// <remarks/>
   [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
   [System.SerializableAttribute()]
   [System.Diagnostics.DebuggerStepThroughAttribute()]
   [System.ComponentModel.DesignerCategoryAttribute("code")]
   [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
   [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
   public partial class SecondPage {
  
   private string urlField;
  
   /**//// <remarks/>
   [System.Xml.Serialization.XmlAttributeAttribute()]
   public string Url {
   get {
   return this.urlField;
   }
   set {
   this.urlField = value;
   }
   }
   }
  }
  正常情况下,我们需要对工具生成的类文件做一些修改,修改如下:
  Code
  //------------------------------------------------------------------------------
  // <auto-generated>
  // 此代码由工具生成。
  // 运行库版本:2.0.50727.832
  //
  // 对此文件的更改可能会导致不正确的行为,并且如果
  // 重新生成代码,这些更改将会丢失。
  // </auto-generated>
  //------------------------------------------------------------------------------
  
  //
  // 此源代码由 xsd 自动生成, Version=2.0.50727.42。
  //
  using System.Xml.Serialization;
  
  
  public partial class Pages {
  
   private FirstPage[] firstPageField;
  
   [XmlElementAttribute("FirstPage")]
   public FirstPage[] FirstPage {
   get {
   return this.firstPageField;
   }
   set {
   this.firstPageField = value;
   }
   }
 &nb

上页  [1] [2] [3] [4] [5] [6] [7] 下页  




久尚整理     更多关于xml反序列化时 如何生成与之对应的类文件 的文章

{$Title}
搜索:

CSS样式表制作文字

不安装和修改文件

周付联盟推荐第九

QQ免费电子密保卡

QQ邮箱再更新 优化