ContentRangeHeaderParser Class
System.Net.Http.Headers.ContentRangeHeaderParser
Summary
Provides a parser for the Content-Range HTTP header.
Constructors
ContentRangeHeaderParser()
public ContentRangeHeaderParser()
Initializes a new instance of the ContentRangeHeaderParser class.
Methods
Parse(string value)
public static ContentRangeHeaderValue Parse(string value)
Parses a Content-Range header from the specified string.
| Parameter | Type | Description |
|---|---|---|
value |
string | The string to parse. |
| Return Value | Description |
|---|---|
| ContentRangeHeaderValue | A ContentRangeHeaderValue object. |
TryParse(string value, out ContentRangeHeaderValue parsedValue)
public static bool TryParse(string value, out ContentRangeHeaderValue parsedValue)
Tries to parse a Content-Range header from the specified string.
| Parameter | Type | Description |
|---|---|---|
value |
string | The string to parse. |
parsedValue |
out ContentRangeHeaderValue | When this method returns, contains the parsed ContentRangeHeaderValue object, if the parse succeeded. |
| Return Value | Description |
|---|---|
| bool | true if the string was parsed successfully; otherwise, false. |
Remarks
The Content-Range header indicates the partial range of the resource that is being transferred. It is typically used in response to a Range request header.
The format of the Content-Range header is:
Content-Range: <unit> <range-start>-<range-end>/<total-size>
Where:
<unit>is the unit of range specification (e.g.,bytes).<range-start>is the starting byte offset of the range.<range-end>is the ending byte offset of the range.<total-size>is the total size of the resource. It can be*if the total size is unknown.
For example:
Content-Range: bytes 0-499/1000