Export (0) Print
Expand All
1 out of 3 rated this helpful - Rate this topic

ContentType Class

Represents a MIME protocol Content-Type header.

System.Object
  System.Net.Mime.ContentType

Namespace:  System.Net.Mime
Assembly:  System (in System.dll)
'Declaration
Public Class ContentType

The ContentType type exposes the following members.

  NameDescription
Public methodContentTypeInitializes a new default instance of the ContentType class.
Public methodContentType(String)Initializes a new instance of the ContentType class using the specified string.
Top
  NameDescription
Public propertyBoundaryGets or sets the value of the boundary parameter included in the Content-Type header represented by this instance.
Public propertyCharSetGets or sets the value of the charset parameter included in the Content-Type header represented by this instance.
Public propertyMediaTypeGets or sets the media type value included in the Content-Type header represented by this instance.
Public propertyNameGets or sets the value of the name parameter included in the Content-Type header represented by this instance.
Public propertyParametersGets the dictionary that contains the parameters included in the Content-Type header represented by this instance.
Top
  NameDescription
Public methodEqualsDetermines whether the content-type header of the specified ContentType object is equal to the content-type header of this object. (Overrides Object.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeDetermines the hash code of the specified ContentType object (Overrides Object.GetHashCode.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string representation of this ContentType object. (Overrides Object.ToString.)
Top

The information in the ContentType class is used to describe the data contained in an e-mail message in such a way that software that displays e-mail can present the content in an appropriate manner. ContentType is used with the Attachment class to specify the type of content in the attachment.

The syntax of the Content-Type header is described in RFC 2045 Section 5.1. RFC 2046 provides detailed information about MIME media types and their parameters. These RFCs are available at http://www.ietf.org.

The following code example sends an e-mail message with an attachment and displays the ContentDisposition properties for the attachment.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.