Class MimeTypeSelector
Selector used in selecting which MIME type to use.
Inheritance
Implements
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public sealed class MimeTypeSelector : IComparable<MimeTypeSelector>
Constructors
| Improve this Doc View SourceMimeTypeSelector(string, string, double, int)
Creates a new MIME Type Selector.
Declaration
public MimeTypeSelector(string type, string charset, double quality, int order)
Parameters
Type | Name | Description |
---|---|---|
string | type | MIME Type to match. |
string | charset | Charset. |
double | quality | Quality (in range 0.0-1.0). |
int | order | Order of appearance (used as precendence tiebreaker where necessary). |
Properties
| Improve this Doc View SourceCharset
Gets the Charset for the selector (may be null if none specified).
Declaration
public string Charset { get; }
Property Value
Type | Description |
---|---|
string |
IsAny
Gets whether the selector if for a / pattern i.e. accept any.
Declaration
public bool IsAny { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsInvalid
Gets whether the selector is invalid.
Declaration
public bool IsInvalid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRange
Gets whether the selector is for a type/* pattern i.e. accept any sub-type of the given type.
Declaration
public bool IsRange { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSpecific
Gets whether the selector is for a specific MIME type e.g. type/sub-type.
Declaration
public bool IsSpecific { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Order
Gets the order of apperance for the selector (used as precedence tiebreaker where necessary).
Declaration
public int Order { get; }
Property Value
Type | Description |
---|---|
int |
Quality
Gets the quality for the selector (range of 0.0-1.0).
Declaration
public double Quality { get; }
Property Value
Type | Description |
---|---|
double |
RangeType
Gets the range type if this is a range selector.
Declaration
public string RangeType { get; }
Property Value
Type | Description |
---|---|
string | A type string of the form type/ if this is a range selector, otherwise null. |
Type
Gets the selected type.
Declaration
public string Type { get; }
Property Value
Type | Description |
---|---|
string | A type string of the form type/subtype assuming the type if valid. |
Methods
| Improve this Doc View SourceCompareTo(MimeTypeSelector)
Sorts the selector in precedence order according to the content negotiation rules from the relevant RFCs.
Declaration
public int CompareTo(MimeTypeSelector other)
Parameters
Type | Name | Description |
---|---|---|
MimeTypeSelector | other | Selector to compare against. |
Returns
Type | Description |
---|---|
int |
Create(string, int)
Creates a MIME Type selector.
Declaration
public static MimeTypeSelector Create(string contentType, int order)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | MIME Type. |
int | order | Order the selector appears in the input. |
Returns
Type | Description |
---|---|
MimeTypeSelector |
CreateSelectors(IEnumerable<string>)
Creates an enumeration of MIME type selectors.
Declaration
public static IEnumerable<MimeTypeSelector> CreateSelectors(IEnumerable<string> ctypes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><string> | ctypes | MIME Types. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><MimeTypeSelector> |
ToString()
Gets the string representation of the selector as it would appear in an Accept header.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Remarks
Unless this is an invalid selector this will always be a valid selector that could be appended to a MIME type header.