MimeType

Field: static readonly MimeType Default

Returns the default MimeType information. (Extension: "", ContentType: "application/octet-stream")


Method: static MimeType Parse(String)

Extension is the method that creates the MimeType object with the information.

If the extension value is not a known MimeType, the ContentType value is specified as application/octet-stream.

    MimeType.Parse(".txt").Extension; //".txt"
    MimeType.Parse(".txt").ContentType; //"text/plain"

    MimeType.Parse(".unknownextension").Extension; //".unknownextension"
    MimeType.Parse(".unknownextension").ContentType; //"application/octet-stream"
Parameter Name Description
extension Extension value in string type

Error Type: ArgumentNullException (This error is thrown if the value is set null.)

Error Type: FormatException (This error is thrown If the extension does not begin with a period (.) )


Method: static List<MimeType> GetAllMimeTypes()

Returns all defined MimeType objects.


Property: string ContentType

Returns the ContentType value of the data.

    MimeType.Parse(".txt").ContentType; //"text/plain"

Property: string Extension

Returns the Extension value of the data.

    MimeType.Parse(".txt").Extension; //".txt"

Property: string Value

Returns the Extension value of the data.

    MimeType.Parse(".txt").Value; //".txt"

Method: string ToString()

Returns the Extension value of the data.

    MimeType.Parse(".txt").ToString(); //".txt"

Method: bool Equals(Object)

Returns true if the given object has the same value as the MimeType object and the data, false otherwise.

Parameter Name Description
obj Object to be compared

Method: bool Equals(MimeType)

Returns true if the given MimeType object has the same value as the data, false otherwise.

Parameter Name Description
other The object of type MimeType to be compared