IsContentTypeSupported Method
Collapse the table of content
Expand the table of content

MessageEncoder.IsContentTypeSupported Method (String)

 

Returns a value that indicates whether a specified message-level content-type value is supported by the message encoder.

Namespace:   System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public virtual bool IsContentTypeSupported(
	string contentType
)

Parameters

contentType
Type: System.String

The message-level content-type being tested.

Return Value

Type: System.Boolean

true if the message-level content-type specified is supported; otherwise false.

This method is used to determine whether the message encoder can be used to read a particular style of message, based on its content-type. The information in the ContentType class is used to describe the data that is contained in a message and is used to determine if there is a content-type match.

A grammar that details the syntax of the content-type header is described in RFC 2045 Section 5.1. RFC 2046 provides detailed information on Multipurpose Internet Mail Extensions (MIME) media types and their parameters.

The following code example shows how to override this method to handle different content types with the same media type.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft