public void Serialize(object value, MediaRange mediaRange, Stream output) { var property = value as ProfilePropertyData; if (property == null) return; var obj = property.Value; if (obj == null) return; using (var wrt = new StreamWriter(output)) wrt.Write(obj); }
public bool CanDeserialize(Type type, object target, MediaRange mediaRange) { return type == typeof(ProfilePropertyRequest) && mediaRange == "text/plain"; }
public void Serialize(object value, MediaRange mediaRange, Stream output) { using (var jsonWriter = new JsonTextWriter(new StreamWriter(output))) serializer.Serialize(jsonWriter, value); }
public bool CanSerialize(object value, MediaRange mediaRange) { return IsJsonType(mediaRange); }
public bool CanSerialize(object value, MediaRange mediaRange) { return value is ProfilePropertyData && mediaRange == "text/plain"; }
public bool CanDeserialize(Type type, object target, MediaRange mediaRange) { return IsJsonType(mediaRange); }
/// <summary> /// Whether or not a media range matches another, taking into account wildcards and parameters. /// </summary> /// <param name="other">Other media range.</param> /// <returns>True if matching, false if not.</returns> public bool MatchesWithParameters(MediaRange other) { Contract.Requires<ArgumentNullException>(other != null); return Matches(other) && parameters.Matches(other.parameters); }
/// <summary> /// Whether or not a media range matches another, taking into account wildcards. /// </summary> /// <param name="other">Other media range.</param> /// <returns>True if matching, false if not.</returns> public bool Matches(MediaRange other) { Contract.Requires<ArgumentNullException>(other != null); return type.Matches(other.type) && subtype.Matches(other.subtype); }