/// <summary> /// Initializes a new instance of the <see cref="ClientSourcedString"/> class. /// Copy Constructor /// </summary> /// <param name="value">Another instance of a ClientSourcedString</param> public ClientSourcedString(ClientSourcedString value) { // Protect against self reference. if (this != value) { this._trusted = value._trusted; this._untrusted = value._untrusted; } }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { ClientSourcedString css = value as ClientSourcedString; if (css == null) { throw new InvalidCastException(); } writer.WriteValue(css.ToTrustedString()); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { ClientSourcedString css = (string)reader.Value; return(css); }