Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

MediaType

class MediaType

Module: System.Web.Http
Assembly: System.Web.dll
Source file: MediaType.rvn

Inheritance: Object → MediaType
Implements: EquatableTo<MediaType>

An immutable concrete HTTP media type with decoded parameters and value equality.

Remarks

Development API. Type, subtype and parameter names are ASCII case-insensitive. Charset values ignore ASCII case; other values use ordinal equality. Parameter order and quoting do not affect equality. Accept ranges and quality weights are not media types.

Properties

5 items
CharSet: Optional<string> The declared charset, or None. Does not select or validate a body codec.
Parameters: Sequence<KeyValuePair<string, string>> A retained read-only parameter view in input order, with lowercase names and decoded values.
SubType: string The full lowercase subtype, including any structured suffix.
Suffix: Optional<string> The final nonempty structured suffix after +, or None.
Type: string The lowercase top-level type, such as application.

Methods

8 items
Equals(other: MediaType) -> bool Compares structure without parameter ordering or quoting; this is not Accept matching. Implements EquatableTo<MediaType>.Equals
Equals(other: object?) -> bool Compares a MediaType; null and other object types are unequal. Overrides Object.Equals
GetHashCode() -> int Returns a hash consistent with order-independent value equality. Overrides Object.GetHashCode
GetParameter(name: string) -> Optional<string> Looks up a parameter using ASCII case-insensitive naming.
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Static member: Parse(text: string) -> Result<MediaType, HttpError> Parses a concrete Content-Type value without changing any body.
ToString() -> string Formats normalized names and safely quoted parameters in retained order. Overrides Object.ToString
WithParameter(name: string, value: string) -> Result<MediaType, HttpError> Returns a new value with a parameter added or replaced, preserving this instance.