// ------------------------------------------------------------------------------ // <auto-generated> // Generated by Xsd2Code. Version 3.0.0.41569 // <NameSpace>Xsd2Code.TestUnit</NameSpace><Collection>List</Collection><codeType>CSharp</codeType><EnableDataBinding>True</EnableDataBinding><EnableLasyLoading>False</EnableLasyLoading><HidePrivateFieldInIDE>True</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net30</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><AutomaticProperties>False</AutomaticProperties><DisableDebug>True</DisableDebug><CustomUsings></CustomUsings> // </auto-generated> // ------------------------------------------------------------------------------ namespace Xsd2Code.TestUnit { using System; using System.Diagnostics; using System.Xml.Serialization; using System.Collections; using System.Xml.Schema; using System.ComponentModel; using System.IO; using System.Collections.Generic; /// <summary> /// Actor pépé class include firstname and lastname (ûàéçè). /// </summary> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public partial class Actor { [EditorBrowsable(EditorBrowsableState.Never)] private string firstnameField; [EditorBrowsable(EditorBrowsableState.Never)] private string lastnameField; [EditorBrowsable(EditorBrowsableState.Never)] private bool principalActorField; [EditorBrowsable(EditorBrowsableState.Never)] private bool principalActorFieldSpecified; [EditorBrowsable(EditorBrowsableState.Never)] private string nationalityField; private static System.Xml.Serialization.XmlSerializer serializer; public Actor() { this.nationalityField = "US"; } /// <summary> /// Gets or sets the firstname of the actor /// </summary> public string firstname { get { return this.firstnameField; } set { if ((this.firstnameField != null)) { if ((firstnameField.Equals(value) != true)) { this.firstnameField = value; this.OnPropertyChanged("firstname"); } } else { this.firstnameField = value; this.OnPropertyChanged("firstname"); } } } /// <summary> /// Gets or sets the lastname of the actor /// </summary> public string lastname { get { return this.lastnameField; } set { if ((this.lastnameField != null)) { if ((lastnameField.Equals(value) != true)) { this.lastnameField = value; this.OnPropertyChanged("lastname"); } } else { this.lastnameField = value; this.OnPropertyChanged("lastname"); } } } [System.Xml.Serialization.XmlAttributeAttribute()] public bool PrincipalActor { get { return this.principalActorField; } set { if ((principalActorField.Equals(value) != true)) { this.principalActorField = value; this.OnPropertyChanged("PrincipalActor"); } } } [System.Xml.Serialization.XmlIgnoreAttribute()] public bool PrincipalActorSpecified { get { return this.principalActorFieldSpecified; } set { if ((principalActorFieldSpecified.Equals(value) != true)) { this.principalActorFieldSpecified = value; this.OnPropertyChanged("PrincipalActorSpecified"); } } } /// <summary> /// nationality of actor /// </summary> [System.Xml.Serialization.XmlAttributeAttribute()] [System.ComponentModel.DefaultValueAttribute("US")] public string nationality { get { return this.nationalityField; } set { if ((this.nationalityField != null)) { if ((nationalityField.Equals(value) != true)) { this.nationalityField = value; this.OnPropertyChanged("nationality"); } } else { this.nationalityField = value; this.OnPropertyChanged("nationality"); } } } private static System.Xml.Serialization.XmlSerializer Serializer { get { if (serializer == null) { serializer = new System.Xml.Serialization.XmlSerializer(typeof(Actor)); } return serializer; } } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; public virtual void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); } } #region Serialize/Deserialize /// <summary> /// Serializes current Actor object into an XML document /// </summary> // <returns>string XML value</returns> public virtual string Serialize() { System.IO.StreamReader streamReader = null; System.IO.MemoryStream memoryStream = null; try { memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); return streamReader.ReadToEnd(); } finally { if (streamReader != null) { streamReader.Dispose(); } if (memoryStream != null) { memoryStream.Dispose(); } } } /// <summary> /// Deserializes workflow markup into an Actor object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output Actor object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out Actor obj, out System.Exception exception) { exception = null; obj = default(Actor); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool Deserialize(string xml, out Actor obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); } public static Actor Deserialize(string xml) { System.IO.StringReader stringReader = null; try { stringReader = new System.IO.StringReader(xml); return ((Actor)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)))); } finally { if (stringReader != null) { stringReader.Dispose(); } } } /// <summary> /// Serializes current Actor object into file /// </summary> // <param name="fileName">full path of outupt xml file</param> // <param name="exception">output Exception value if failed</param> // <returns>true if can serialize and save into file; otherwise, false</returns> public virtual bool SaveToFile(string fileName, out System.Exception exception) { exception = null; try { SaveToFile(fileName); return true; } catch (System.Exception e) { exception = e; return false; } } public virtual void SaveToFile(string fileName) { System.IO.StreamWriter streamWriter = null; try { string xmlString = Serialize(); System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName); streamWriter = xmlFile.CreateText(); streamWriter.WriteLine(xmlString); streamWriter.Close(); } finally { if (streamWriter != null) { streamWriter.Dispose(); } } } /// <summary> /// Deserializes workflow markup from file into an Actor object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output Actor object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out Actor obj, out System.Exception exception) { exception = null; obj = default(Actor); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool LoadFromFile(string fileName, out Actor obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); } public static Actor LoadFromFile(string fileName) { System.IO.FileStream file = null; System.IO.StreamReader sr = null; try { file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read); sr = new System.IO.StreamReader(file); string xmlString = sr.ReadToEnd(); sr.Close(); file.Close(); return Deserialize(xmlString); } finally { if (file != null) { file.Dispose(); } if (sr != null) { sr.Dispose(); } } } #endregion #region Clone method /// <summary> /// Create a clone of this Actor object /// </summary> public virtual Actor Clone() { return ((Actor)(this.MemberwiseClone())); } #endregion } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public partial class DvdCollection { [EditorBrowsable(EditorBrowsableState.Never)] private List<dvd> dvdsField; private static System.Xml.Serialization.XmlSerializer serializer; /// <summary> /// .ctor class constructor /// </summary> public DvdCollection() { this.dvdsField = new List<dvd>(); } [System.Xml.Serialization.XmlElementAttribute("Dvds")] public List<dvd> Dvds { get { return this.dvdsField; } set { if ((this.dvdsField != null)) { if ((dvdsField.Equals(value) != true)) { this.dvdsField = value; this.OnPropertyChanged("Dvds"); } } else { this.dvdsField = value; this.OnPropertyChanged("Dvds"); } } } private static System.Xml.Serialization.XmlSerializer Serializer { get { if (serializer == null) { serializer = new System.Xml.Serialization.XmlSerializer(typeof(DvdCollection)); } return serializer; } } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; public virtual void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); } } #region Serialize/Deserialize /// <summary> /// Serializes current DvdCollection object into an XML document /// </summary> // <returns>string XML value</returns> public virtual string Serialize() { System.IO.StreamReader streamReader = null; System.IO.MemoryStream memoryStream = null; try { memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); return streamReader.ReadToEnd(); } finally { if (streamReader != null) { streamReader.Dispose(); } if (memoryStream != null) { memoryStream.Dispose(); } } } /// <summary> /// Deserializes workflow markup into an DvdCollection object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output DvdCollection object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out DvdCollection obj, out System.Exception exception) { exception = null; obj = default(DvdCollection); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool Deserialize(string xml, out DvdCollection obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); } public static DvdCollection Deserialize(string xml) { System.IO.StringReader stringReader = null; try { stringReader = new System.IO.StringReader(xml); return ((DvdCollection)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)))); } finally { if (stringReader != null) { stringReader.Dispose(); } } } /// <summary> /// Serializes current DvdCollection object into file /// </summary> // <param name="fileName">full path of outupt xml file</param> // <param name="exception">output Exception value if failed</param> // <returns>true if can serialize and save into file; otherwise, false</returns> public virtual bool SaveToFile(string fileName, out System.Exception exception) { exception = null; try { SaveToFile(fileName); return true; } catch (System.Exception e) { exception = e; return false; } } public virtual void SaveToFile(string fileName) { System.IO.StreamWriter streamWriter = null; try { string xmlString = Serialize(); System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName); streamWriter = xmlFile.CreateText(); streamWriter.WriteLine(xmlString); streamWriter.Close(); } finally { if (streamWriter != null) { streamWriter.Dispose(); } } } /// <summary> /// Deserializes workflow markup from file into an DvdCollection object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output DvdCollection object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out DvdCollection obj, out System.Exception exception) { exception = null; obj = default(DvdCollection); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool LoadFromFile(string fileName, out DvdCollection obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); } public static DvdCollection LoadFromFile(string fileName) { System.IO.FileStream file = null; System.IO.StreamReader sr = null; try { file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read); sr = new System.IO.StreamReader(file); string xmlString = sr.ReadToEnd(); sr.Close(); file.Close(); return Deserialize(xmlString); } finally { if (file != null) { file.Dispose(); } if (sr != null) { sr.Dispose(); } } } #endregion #region Clone method /// <summary> /// Create a clone of this DvdCollection object /// </summary> public virtual DvdCollection Clone() { return ((DvdCollection)(this.MemberwiseClone())); } #endregion } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")] [System.Diagnostics.DebuggerStepThroughAttribute()] public partial class dvd { [EditorBrowsable(EditorBrowsableState.Never)] private string titleField; [EditorBrowsable(EditorBrowsableState.Never)] private Styles styleField; [EditorBrowsable(EditorBrowsableState.Never)] private List<Actor> actorField; [EditorBrowsable(EditorBrowsableState.Never)] private int publishYearField; private static System.Xml.Serialization.XmlSerializer serializer; public dvd() { this.actorField = new List<Actor>(); this.titleField = "DefaultTitle"; this.styleField = Styles.Action; } [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] public string Title { get { return this.titleField; } set { if ((this.titleField != null)) { if ((titleField.Equals(value) != true)) { this.titleField = value; this.OnPropertyChanged("Title"); } } else { this.titleField = value; this.OnPropertyChanged("Title"); } } } public Styles Style { get { return this.styleField; } set { if ((styleField.Equals(value) != true)) { this.styleField = value; this.OnPropertyChanged("Style"); } } } [System.Xml.Serialization.XmlElementAttribute("Actor")] public List<Actor> Actor { get { return this.actorField; } set { if ((this.actorField != null)) { if ((actorField.Equals(value) != true)) { this.actorField = value; this.OnPropertyChanged("Actor"); } } else { this.actorField = value; this.OnPropertyChanged("Actor"); } } } public int PublishYear { get { return this.publishYearField; } set { if ((publishYearField.Equals(value) != true)) { this.publishYearField = value; this.OnPropertyChanged("PublishYear"); } } } private static System.Xml.Serialization.XmlSerializer Serializer { get { if (serializer == null) { serializer = new System.Xml.Serialization.XmlSerializer(typeof(dvd)); } return serializer; } } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; public virtual void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); } } #region Serialize/Deserialize /// <summary> /// Serializes current dvd object into an XML document /// </summary> // <returns>string XML value</returns> public virtual string Serialize() { System.IO.StreamReader streamReader = null; System.IO.MemoryStream memoryStream = null; try { memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); return streamReader.ReadToEnd(); } finally { if (streamReader != null) { streamReader.Dispose(); } if (memoryStream != null) { memoryStream.Dispose(); } } } /// <summary> /// Deserializes workflow markup into an dvd object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output dvd object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out dvd obj, out System.Exception exception) { exception = null; obj = default(dvd); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool Deserialize(string xml, out dvd obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); } public static dvd Deserialize(string xml) { System.IO.StringReader stringReader = null; try { stringReader = new System.IO.StringReader(xml); return ((dvd)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)))); } finally { if (stringReader != null) { stringReader.Dispose(); } } } /// <summary> /// Serializes current dvd object into file /// </summary> // <param name="fileName">full path of outupt xml file</param> // <param name="exception">output Exception value if failed</param> // <returns>true if can serialize and save into file; otherwise, false</returns> public virtual bool SaveToFile(string fileName, out System.Exception exception) { exception = null; try { SaveToFile(fileName); return true; } catch (System.Exception e) { exception = e; return false; } } public virtual void SaveToFile(string fileName) { System.IO.StreamWriter streamWriter = null; try { string xmlString = Serialize(); System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName); streamWriter = xmlFile.CreateText(); streamWriter.WriteLine(xmlString); streamWriter.Close(); } finally { if (streamWriter != null) { streamWriter.Dispose(); } } } /// <summary> /// Deserializes workflow markup from file into an dvd object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output dvd object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out dvd obj, out System.Exception exception) { exception = null; obj = default(dvd); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool LoadFromFile(string fileName, out dvd obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); } public static dvd LoadFromFile(string fileName) { System.IO.FileStream file = null; System.IO.StreamReader sr = null; try { file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read); sr = new System.IO.StreamReader(file); string xmlString = sr.ReadToEnd(); sr.Close(); file.Close(); return Deserialize(xmlString); } finally { if (file != null) { file.Dispose(); } if (sr != null) { sr.Dispose(); } } } #endregion #region Clone method /// <summary> /// Create a clone of this dvd object /// </summary> public virtual dvd Clone() { return ((dvd)(this.MemberwiseClone())); } #endregion } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")] public enum Styles { /// <remarks/> Action, /// <remarks/> Fiction, } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public partial class Actors { [EditorBrowsable(EditorBrowsableState.Never)] private List<Actor> actorField; private static System.Xml.Serialization.XmlSerializer serializer; /// <summary> /// .ctor class constructor /// </summary> public Actors() { this.actorField = new List<Actor>(); } [System.Xml.Serialization.XmlElementAttribute("Actor")] public List<Actor> Actor { get { return this.actorField; } set { if ((this.actorField != null)) { if ((actorField.Equals(value) != true)) { this.actorField = value; this.OnPropertyChanged("Actor"); } } else { this.actorField = value; this.OnPropertyChanged("Actor"); } } } private static System.Xml.Serialization.XmlSerializer Serializer { get { if (serializer == null) { serializer = new System.Xml.Serialization.XmlSerializer(typeof(Actors)); } return serializer; } } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; public virtual void OnPropertyChanged(string info) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(info)); } } #region Serialize/Deserialize /// <summary> /// Serializes current Actors object into an XML document /// </summary> // <returns>string XML value</returns> public virtual string Serialize() { System.IO.StreamReader streamReader = null; System.IO.MemoryStream memoryStream = null; try { memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); return streamReader.ReadToEnd(); } finally { if (streamReader != null) { streamReader.Dispose(); } if (memoryStream != null) { memoryStream.Dispose(); } } } /// <summary> /// Deserializes workflow markup into an Actors object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output Actors object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out Actors obj, out System.Exception exception) { exception = null; obj = default(Actors); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool Deserialize(string xml, out Actors obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); } public static Actors Deserialize(string xml) { System.IO.StringReader stringReader = null; try { stringReader = new System.IO.StringReader(xml); return ((Actors)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)))); } finally { if (stringReader != null) { stringReader.Dispose(); } } } /// <summary> /// Serializes current Actors object into file /// </summary> // <param name="fileName">full path of outupt xml file</param> // <param name="exception">output Exception value if failed</param> // <returns>true if can serialize and save into file; otherwise, false</returns> public virtual bool SaveToFile(string fileName, out System.Exception exception) { exception = null; try { SaveToFile(fileName); return true; } catch (System.Exception e) { exception = e; return false; } } public virtual void SaveToFile(string fileName) { System.IO.StreamWriter streamWriter = null; try { string xmlString = Serialize(); System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName); streamWriter = xmlFile.CreateText(); streamWriter.WriteLine(xmlString); streamWriter.Close(); } finally { if (streamWriter != null) { streamWriter.Dispose(); } } } /// <summary> /// Deserializes workflow markup from file into an Actors object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output Actors object</param> // <param name="exception">output Exception value if deserialize failed</param> // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out Actors obj, out System.Exception exception) { exception = null; obj = default(Actors); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool LoadFromFile(string fileName, out Actors obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); } public static Actors LoadFromFile(string fileName) { System.IO.FileStream file = null; System.IO.StreamReader sr = null; try { file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read); sr = new System.IO.StreamReader(file); string xmlString = sr.ReadToEnd(); sr.Close(); file.Close(); return Deserialize(xmlString); } finally { if (file != null) { file.Dispose(); } if (sr != null) { sr.Dispose(); } } } #endregion #region Clone method /// <summary> /// Create a clone of this Actors object /// </summary> public virtual Actors Clone() { return ((Actors)(this.MemberwiseClone())); } #endregion } }