/// <summary> /// Updates the given <see cref="formatter"/>'s set of <see cref="MediaTypeMapping"/> elements /// so that it associates the <paramref name="mediaType"/> with requests or responses containing /// <paramref name="mediaRange"/> in the content headers. /// </summary> /// <param name="formatter">The <see cref="MediaTypeFormatter"/> to receive the new <see cref="MediaRangeMapping"/> item.</param> /// <param name="mediaRange">The media range that will appear in the content headers.</param> /// <param name="mediaType">The media type to associate with that <paramref name="mediaRange"/>.</param> public static void AddMediaRangeMapping(this MediaTypeFormatter formatter, string mediaRange, string mediaType) { if (formatter == null) { throw Fx.Exception.ArgumentNull("formatter"); } MediaRangeMapping mapping = new MediaRangeMapping(mediaRange, mediaType); formatter.MediaTypeMappings.Add(mapping); }
/// <summary> /// Updates the given <see cref="formatter"/>'s set of <see cref="MediaTypeMapping"/> elements /// so that it associates the <paramref name="mediaType"/> with requests or responses containing /// <paramref name="mediaRange"/> in the content headers. /// </summary> /// <param name="formatter">The <see cref="MediaTypeFormatter"/> to receive the new <see cref="MediaRangeMapping"/> item.</param> /// <param name="mediaRange">The media range that will appear in the content headers.</param> /// <param name="mediaType">The media type to associate with that <paramref name="mediaRange"/>.</param> public static void AddMediaRangeMapping(this MediaTypeFormatter formatter, string mediaRange, string mediaType) { if (formatter == null) { throw Fx.Exception.ArgumentNull("formatter"); } MediaRangeMapping mapping = new MediaRangeMapping(mediaRange, mediaType); formatter.MediaTypeMappings.Add(mapping); }