本文整理汇总了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;
}
}
}