本文整理汇总了C#中EncodingType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# EncodingType.ToString方法的具体用法?C# EncodingType.ToString怎么用?C# EncodingType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EncodingType
的用法示例。
在下文中一共展示了EncodingType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompressedContent
public CompressedContent(HttpContent content, EncodingType encodingType)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
originalContent = content;
this.encodingType = encodingType;
// copy the headers from the original content
foreach (KeyValuePair<string, IEnumerable<string>> header in originalContent.Headers)
{
this.Headers.TryAddWithoutValidation(header.Key, header.Value);
}
this.Headers.ContentEncoding.Add(encodingType.ToString());
}
示例2: GetEncoding
private static Encoding GetEncoding(EncodingType type)
{
Debug.Assert(HttpSysSettings.EnableNonUtf8,
"If 'EnableNonUtf8' is false we shouldn't require an encoding. It's always Utf-8.");
Debug.Assert((type == EncodingType.Primary) || (type == EncodingType.Secondary),
"Unknown 'EncodingType' value: " + type.ToString());
if (((type == EncodingType.Primary) && (!HttpSysSettings.FavorUtf8)) ||
((type == EncodingType.Secondary) && (HttpSysSettings.FavorUtf8)))
{
return ansiEncoding;
}
else
{
return utf8Encoding;
}
}
示例3: GetEncoding
private static Encoding GetEncoding(EncodingType type)
{
Debug.Assert((type == EncodingType.Primary) || (type == EncodingType.Secondary),
"Unknown 'EncodingType' value: " + type.ToString());
if (type == EncodingType.Secondary)
{
return s_ansiEncoding;
}
else
{
return s_utf8Encoding;
}
}