Class ContentType
Represents the value of a Content-Type header field (RFC 2045 §5).
Inherited Members
Namespace: DRIT.Mail.Rfc.Mime
Assembly: DRIT.Mail.dll
Syntax
public sealed class ContentType
Constructors
View SourceContentType(string, string, MimeHeaderParameterCollection)
Initializes a new instance of the ContentType class.
Declaration
public ContentType(string mediaType, string mediaSubtype, MimeHeaderParameterCollection parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| string | mediaType | The media type used by the operation. |
| string | mediaSubtype | The media subtype used by the operation. |
| MimeHeaderParameterCollection | parameters | Specifies the parameters value. |
Properties
View SourceBoundary
Gets the boundary parameter value (for multipart entities), or null if not specified.
Declaration
public string? Boundary { get; }
Property Value
| Type | Description |
|---|---|
| string |
Charset
Gets the charset parameter value, or null if not specified.
Declaration
public string? Charset { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsAttachment
Gets a value indicating whether this content type has a name parameter (suggesting an attachment).
Declaration
public bool IsAttachment { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsMultipart
Gets a value indicating whether this is a multipart content type.
Declaration
public bool IsMultipart { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsText
Gets a value indicating whether this is a text content type.
Declaration
public bool IsText { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MediaSubtype
Gets the media subtype (e.g. plain, html, mixed).
Declaration
public string MediaSubtype { get; }
Property Value
| Type | Description |
|---|---|
| string |
MediaType
Gets the top-level media type (e.g. text, multipart, application).
Declaration
public string MediaType { get; }
Property Value
| Type | Description |
|---|---|
| string |
MimeType
Gets the full MIME type string (e.g. text/plain).
Declaration
public string MimeType { get; }
Property Value
| Type | Description |
|---|---|
| string |
Name
Gets the name parameter value (typically a filename), or null if not specified.
Declaration
public string? Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Parameters
Gets the parameters associated with this Content-Type.
Declaration
public MimeHeaderParameterCollection Parameters { get; }
Property Value
| Type | Description |
|---|---|
| MimeHeaderParameterCollection |
Methods
View SourceParse(string)
Parses a Content-Type header value (e.g. text/plain; charset=utf-8).
Declaration
public static ContentType Parse(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The value to process. |
Returns
| Type | Description |
|---|---|
| ContentType |
ToString()
Processes the to string data.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |