/User.cs Secret
Created
March 23, 2015 00:08
blog 20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public object Clone() | |
{ | |
return new User(this); | |
} | |
public void ToXml(XmlWriter writer) | |
{ | |
writer.WriteStartElement("user"); | |
writer.WriteElementString("username", this.Username); | |
writer.WriteElementString("password", this.Password); | |
this.Metadata.ToXml(writer); | |
writer.WriteEndElement(); | |
} | |
public Newtonsoft.Json.Linq.JObject Data | |
{ | |
get | |
{ | |
JObject j = new JObject | |
{ | |
{"username", this.Username}, | |
{"password", this.Password}, | |
{"metadata", ((IData) (this.Metadata)).Data} | |
}; | |
return j; | |
} | |
} | |
public void ToJson(Newtonsoft.Json.JsonWriter writer) | |
{ | |
writer.WriteStartObject(); | |
writer.WritePropertyName("username"); | |
writer.WriteValue(this.Username); | |
writer.WritePropertyName("password"); | |
writer.WriteValue(this.Password); | |
this.Metadata.ToJson(writer); | |
writer.WriteEndObject(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment