当前位置: 首页>>代码示例>>C#>>正文


C# MessageHeaders.RemoveAt方法代码示例

本文整理汇总了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"));
 }
开发者ID:wisexie,项目名称:WCFDemo,代码行数:10,代码来源:HeaderOperater.cs

示例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"));
 }
开发者ID:wisexie,项目名称:WCFDemo,代码行数:10,代码来源:HeaderOperater.cs

示例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);
                    }
                }
            }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:37,代码来源:SoapProcessingBehavior.cs


注:本文中的MessageHeaders.RemoveAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。