本文整理汇总了C#中MessageHeaders.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# MessageHeaders.RemoveAt方法的具体用法?C# MessageHeaders.RemoveAt怎么用?C# MessageHeaders.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageHeaders
的用法示例。
在下文中一共展示了MessageHeaders.RemoveAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveAppNameHeader
/// <summary>
/// 删除消息头
/// </summary>
/// <param name="headers"></param>
/// <param name="index"></param>
internal static void RemoveAppNameHeader(MessageHeaders headers)
{
if (headers.FindHeader("AppNameHeaderContext", "appnamesession") >= 0)
headers.RemoveAt(headers.FindHeader("AppNameHeaderContext", "appnamesession"));
}
示例2: RemoveHeader
/// <summary>
/// 删除消息头
/// </summary>
/// <param name="headers"></param>
/// <param name="index"></param>
internal static void RemoveHeader(MessageHeaders headers)
{
if (headers.FindHeader("HeaderContext", "session") >= 0)
headers.RemoveAt(headers.FindHeader("HeaderContext", "session"));
}
示例3: FilterHeaders
void FilterHeaders(MessageHeaders headers, HashSet<string> understoodHeadersSet)
{
string addressingNamespace = RoutingUtilities.GetAddressingNamespace(headers.MessageVersion.Addressing);
//Go in reverse to reduce shifting after RemoveAt(i)
for (int i = headers.Count - 1; i >= 0; --i)
{
MessageHeaderInfo header = headers[i];
bool removeHeader = false;
if (string.Equals(header.Namespace, addressingNamespace, StringComparison.Ordinal) &&
(addressingHeadersToFlow.Contains(header.Name) || this.manualAddressing))
{
continue;
}
if (understoodHeadersSet.Contains(MessageHeaderKey(header)))
{
// This header was understood at this endpoint, do _not_ flow it
removeHeader = true;
}
else if (ActorIsNextDestination(header, headers.MessageVersion))
{
//This was a header targeted at the SOAP Intermediary ("actor/next", which is us)
//It can explicitly tell us to relay this header when we don't understand it.
if (!header.Relay)
{
removeHeader = true;
}
}
if (removeHeader)
{
headers.RemoveAt(i);
}
}
}