/// <summary> /// Updates the given <see cref="formatter"/>'s set of <see cref="MediaTypeMapping"/> elements /// so that it associates the <paramref name="mediaType"/> with <see cref="Uri"/>s ending with /// the given <paramref name="uriPathExtension"/>. /// </summary> /// <param name="formatter">The <see cref="MediaTypeFormatter"/> to receive the new <see cref="UriPathExtensionMapping"/> item.</param> /// <param name="uriPathExtension">The string of the <see cref="Uri"/> path extension.</param> /// <param name="mediaType">The string media type to associate with <see cref="Uri"/>s /// ending with <paramref name="uriPathExtension"/>.</param> public static void AddUriPathExtensionMapping(this MediaTypeFormatter formatter, string uriPathExtension, string mediaType) { if (formatter == null) { throw Fx.Exception.ArgumentNull("formatter"); } UriPathExtensionMapping mapping = new UriPathExtensionMapping(uriPathExtension, mediaType); formatter.MediaTypeMappings.Add(mapping); }