本文整理匯總了C#中System.ServiceModel.Channels.MessageEncoderFactory類的典型用法代碼示例。如果您正苦於以下問題:C# MessageEncoderFactory類的具體用法?C# MessageEncoderFactory怎麽用?C# MessageEncoderFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MessageEncoderFactory類屬於System.ServiceModel.Channels命名空間,在下文中一共展示了MessageEncoderFactory類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: IsContentTypeSupported
public override bool IsContentTypeSupported(string contentType)
{
if (base.IsContentTypeSupported(contentType))
{
return true;
}
if (contentType.Length == this.MediaType.Length)
{
return contentType.Equals(this.MediaType, StringComparison.OrdinalIgnoreCase);
}
else
{
if (contentType.StartsWith(this.MediaType, StringComparison.OrdinalIgnoreCase)
&& (contentType[this.MediaType.Length] == ';'))
{
return true;
}
}
return false;
}
示例2: CustomTextMessageEncoderFactory
public class CustomTextMessageEncoderFactory : MessageEncoderFactory
{
private MessageEncoder encoder;
private MessageVersion version;
private string mediaType;
private string charSet;
internal CustomTextMessageEncoderFactory(string mediaType, string charSet,
MessageVersion version)
{
this.version = version;
this.mediaType = mediaType;
this.charSet = charSet;
this.encoder = new CustomTextMessageEncoder(this);
}
public override MessageEncoder Encoder
{
get
{
return this.encoder;
}
}
public override MessageVersion MessageVersion
{
get
{
return this.version;
}
}
internal string MediaType
{
get
{
return this.mediaType;
}
}
internal string CharSet
{
get
{
return this.charSet;
}
}
}