Show / Hide Table of Contents

Class WebContentType

Represents the media type for the content of a System.Net.WebRequest or System.Net.WebResponse.

Inheritance
System.Object
WebContentType
Implements
System.IComparable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Argotic.Net
Assembly: Argotic.Core.dll
Syntax
[Serializable]
public class WebContentType : IComparable
Remarks

See http://www.iana.org/assignments/media-types for a listing of the registered IANA MIME media types and sub-types.

Constructors

| Improve this Doc View Source

WebContentType()

Initializes a new instance of the WebContentType class.

Declaration
public WebContentType()
| Improve this Doc View Source

WebContentType(String, String)

Initializes a new instance of the WebContentType class using the specified media type and sub-type.

Declaration
public WebContentType(string mediaType, string mediaSubtype)
Parameters
Type Name Description
System.String mediaType

The top-level media type used to declare the general type of data the media content represents.

System.String mediaSubtype

The specific format for the general type of data the media content represents

Exceptions
Type Condition
System.ArgumentNullException

The mediaType is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The mediaType is an empty string.

System.ArgumentNullException

The mediaSubtype is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The mediaSubtype is an empty string.

| Improve this Doc View Source

WebContentType(String, String, String)

Initializes a new instance of the WebContentType class using the specified media type, sub-type and type discriminator.

Declaration
public WebContentType(string mediaType, string mediaSubtype, string discriminator)
Parameters
Type Name Description
System.String mediaType

The top-level media type used to declare the general type of data the media content represents.

System.String mediaSubtype

The specific format for the general type of data the media content represents

System.String discriminator

A string value that provides a means of discriminating the media content.

Exceptions
Type Condition
System.ArgumentNullException

The mediaType is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The mediaType is an empty string.

System.ArgumentNullException

The mediaSubtype is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The mediaSubtype is an empty string.

| Improve this Doc View Source

WebContentType(String, String, String, Encoding)

Initializes a new instance of the WebContentType class using the specified media type, sub-type, type discriminator and character encoding.

Declaration
public WebContentType(string mediaType, string mediaSubtype, string discriminator, Encoding characterSet)
Parameters
Type Name Description
System.String mediaType

The top-level media type used to declare the general type of data the media content represents.

System.String mediaSubtype

The specific format for the general type of data the media content represents

System.String discriminator

A string value that provides a means of discriminating the media content.

System.Text.Encoding characterSet

A Encoding object that represents the character encoding of the media content.

Exceptions
Type Condition
System.ArgumentNullException

The mediaType is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The mediaType is an empty string.

System.ArgumentNullException

The mediaSubtype is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The mediaSubtype is an empty string.

System.ArgumentNullException

The characterSet is a null reference (Nothing in Visual Basic).

Properties

| Improve this Doc View Source

CharacterSet

Gets or sets the character encoding of this media content.

Declaration
public string CharacterSet { get; set; }
Property Value
Type Description
System.String

The name registered with the Internet Assigned Numbers Authority (IANA) for the character encoding of this media content. If no character encoding has been specified, returns System.String.Empty.

Remarks

The CharacterSet property gets or sets the charset parameter within the Parameters collection. Specifiying System.String.Empty for the character encoding will remove the charset parameter from the Parameters collection.

| Improve this Doc View Source

Discriminator

Gets or sets the type discriminator of this media content.

Declaration
public string Discriminator { get; set; }
Property Value
Type Description
System.String

A value that provides a means of discriminating this media content. If no type discriminator has been specified, returns System.String.Empty.

Remarks

The Discriminator property gets or sets the type parameter within the Parameters collection. The type parameter can be used to discrimiate between resource representations that share the same MediaType and MediaSubtype. Specifiying System.String.Empty for the type discriminator will remove the type parameter from the Parameters collection.

| Improve this Doc View Source

Encoding

Gets the Encoding for the current CharacterSet.

Declaration
public Encoding Encoding { get; }
Property Value
Type Description
System.Text.Encoding

A Encoding object that represents the character encoding of this media content. If the CharacterSet is not specified, a null reference (Nothing in Visual Basic) is returned.

Exceptions
Type Condition
System.ArgumentException

The CharacterSet is not a valid code page name.

System.ArgumentException

The code page indicated by CharacterSet is not supported by the underlying platform.

| Improve this Doc View Source

MediaSubtype

Gets or sets the specific format for the general type of data this media content represents.

Declaration
public string MediaSubtype { get; set; }
Property Value
Type Description
System.String

The specific format for the general type of data this media content represents.

Exceptions
Type Condition
System.ArgumentNullException

The value is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The value is an empty string.

| Improve this Doc View Source

MediaType

Gets or sets the top-level media type used to declare the general type of data this media content represents.

Declaration
public string MediaType { get; set; }
Property Value
Type Description
System.String

The top-level media type used to declare the general type of data this media content represents.

Exceptions
Type Condition
System.ArgumentNullException

The value is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The value is an empty string.

| Improve this Doc View Source

Parameters

Gets the name/value pairs of additional parameters applied to this media content.

Declaration
public Dictionary<string, string> Parameters { get; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, System.String>

A System.Collections.Generic.Dictionary<TKey, TValue> collection of strings that represents the name/value pairs of additional parameters applied to this media content.

Remarks

The WebContentType class provides accessors for the commonly used type and charset parameters through the CharacterSet and Discriminator properties.

See Also
CharacterSet
Discriminator

Methods

| Improve this Doc View Source

CompareSequence(Dictionary<String, String>, Dictionary<String, String>)

Compares two specified System.Collections.Generic.Dictionary<TKey, TValue> collections.

Declaration
public static int CompareSequence(Dictionary<string, string> source, Dictionary<string, string> target)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.String> source

The first collection.

System.Collections.Generic.Dictionary<System.String, System.String> target

The second collection.

Returns
Type Description
System.Int32

A 32-bit signed integer indicating the lexical relationship between the two comparands.

Remarks

If the collections contain the same number of elements, determines the lexical relationship between the two sequences of comparands.

If the source has an element count that is greater than the target element count, returns 1.

If the source has an element count that is less than the target element count, returns -1.

Exceptions
Type Condition
System.ArgumentNullException

The source is a null reference (Nothing in Visual Basic).

System.ArgumentNullException

The target is a null reference (Nothing in Visual Basic).

| Improve this Doc View Source

CompareTo(Object)

Compares the current instance with another object of the same type.

Declaration
public int CompareTo(object obj)
Parameters
Type Name Description
System.Object obj

An object to compare with this instance.

Returns
Type Description
System.Int32

A 32-bit signed integer that indicates the relative order of the objects being compared.

Exceptions
Type Condition
System.ArgumentException

The obj is not the expected System.Type.

| Improve this Doc View Source

Equals(Object)

Determines whether the specified System.Object is equal to the current instance.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The System.Object to compare with the current instance.

Returns
Type Description
System.Boolean

true if the specified System.Object is equal to the current instance; otherwise, false.

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Returns a hash code for the current instance.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A 32-bit signed integer hash code.

Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

ToString()

Returns a System.String that represents the current WebContentType.

Declaration
public override string ToString()
Returns
Type Description
System.String

A System.String that represents the current WebContentType.

Overrides
System.Object.ToString()
Remarks

This method returns the MIME content type representation for the current instance.

Operators

| Improve this Doc View Source

Equality(WebContentType, WebContentType)

Determines if operands are equal.

Declaration
public static bool operator ==(WebContentType first, WebContentType second)
Parameters
Type Name Description
WebContentType first

Operand to be compared.

WebContentType second

Operand to compare to.

Returns
Type Description
System.Boolean

true if the values of its operands are equal, otherwise; false.

| Improve this Doc View Source

GreaterThan(WebContentType, WebContentType)

Determines if first operand is greater than second operand.

Declaration
public static bool operator>(WebContentType first, WebContentType second)
Parameters
Type Name Description
WebContentType first

Operand to be compared.

WebContentType second

Operand to compare to.

Returns
Type Description
System.Boolean

true if the first operand is greater than the second, otherwise; false.

| Improve this Doc View Source

Inequality(WebContentType, WebContentType)

Determines if operands are not equal.

Declaration
public static bool operator !=(WebContentType first, WebContentType second)
Parameters
Type Name Description
WebContentType first

Operand to be compared.

WebContentType second

Operand to compare to.

Returns
Type Description
System.Boolean

false if its operands are equal, otherwise; true.

| Improve this Doc View Source

LessThan(WebContentType, WebContentType)

Determines if first operand is less than second operand.

Declaration
public static bool operator <(WebContentType first, WebContentType second)
Parameters
Type Name Description
WebContentType first

Operand to be compared.

WebContentType second

Operand to compare to.

Returns
Type Description
System.Boolean

true if the first operand is less than the second, otherwise; false.

Implements

System.IComparable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX