// ------------------------------------------------------------------------------
//
// Generated by Xsd2Code. Version 3.0.0.41569
// Xsd2Code.TestUnitListCSharpTrueFalseTrueTrueTrueFalseTrueFalseNet30SerializeDeserializeSaveToFileLoadFromFileTrueFalseTrue
//
// ------------------------------------------------------------------------------
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;
///
/// Actor pépé class include firstname and lastname (ûàéçè).
///
[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";
}
///
/// Gets or sets the firstname of the actor
///
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");
}
}
}
///
/// Gets or sets the lastname of the actor
///
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");
}
}
}
///
/// nationality of actor
///
[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
///
/// Serializes current Actor object into an XML document
///
// string XML value
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();
}
}
}
///
/// Deserializes workflow markup into an Actor object
///
// string workflow markup to deserialize
// Output Actor object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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();
}
}
}
///
/// Serializes current Actor object into file
///
// full path of outupt xml file
// output Exception value if failed
// true if can serialize and save into file; otherwise, false
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();
}
}
}
///
/// Deserializes workflow markup from file into an Actor object
///
// string workflow markup to deserialize
// Output Actor object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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
///
/// Create a clone of this Actor object
///
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 dvdsField;
private static System.Xml.Serialization.XmlSerializer serializer;
///
/// .ctor class constructor
///
public DvdCollection() {
this.dvdsField = new List();
}
[System.Xml.Serialization.XmlElementAttribute("Dvds")]
public List 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
///
/// Serializes current DvdCollection object into an XML document
///
// string XML value
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();
}
}
}
///
/// Deserializes workflow markup into an DvdCollection object
///
// string workflow markup to deserialize
// Output DvdCollection object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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();
}
}
}
///
/// Serializes current DvdCollection object into file
///
// full path of outupt xml file
// output Exception value if failed
// true if can serialize and save into file; otherwise, false
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();
}
}
}
///
/// Deserializes workflow markup from file into an DvdCollection object
///
// string workflow markup to deserialize
// Output DvdCollection object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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
///
/// Create a clone of this DvdCollection object
///
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 actorField;
[EditorBrowsable(EditorBrowsableState.Never)]
private int publishYearField;
private static System.Xml.Serialization.XmlSerializer serializer;
public dvd() {
this.actorField = new List();
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 {
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
///
/// Serializes current dvd object into an XML document
///
// string XML value
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();
}
}
}
///
/// Deserializes workflow markup into an dvd object
///
// string workflow markup to deserialize
// Output dvd object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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();
}
}
}
///
/// Serializes current dvd object into file
///
// full path of outupt xml file
// output Exception value if failed
// true if can serialize and save into file; otherwise, false
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();
}
}
}
///
/// Deserializes workflow markup from file into an dvd object
///
// string workflow markup to deserialize
// Output dvd object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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
///
/// Create a clone of this dvd object
///
public virtual dvd Clone() {
return ((dvd)(this.MemberwiseClone()));
}
#endregion
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
public enum Styles {
///
Action,
///
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 actorField;
private static System.Xml.Serialization.XmlSerializer serializer;
///
/// .ctor class constructor
///
public Actors() {
this.actorField = new List();
}
[System.Xml.Serialization.XmlElementAttribute("Actor")]
public List 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
///
/// Serializes current Actors object into an XML document
///
// string XML value
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();
}
}
}
///
/// Deserializes workflow markup into an Actors object
///
// string workflow markup to deserialize
// Output Actors object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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();
}
}
}
///
/// Serializes current Actors object into file
///
// full path of outupt xml file
// output Exception value if failed
// true if can serialize and save into file; otherwise, false
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();
}
}
}
///
/// Deserializes workflow markup from file into an Actors object
///
// string workflow markup to deserialize
// Output Actors object
// output Exception value if deserialize failed
// true if this XmlSerializer can deserialize the object; otherwise, false
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
///
/// Create a clone of this Actors object
///
public virtual Actors Clone() {
return ((Actors)(this.MemberwiseClone()));
}
#endregion
}
}