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


C# BindingElementCollection.Remove方法代码示例

本文整理汇总了C#中BindingElementCollection.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# BindingElementCollection.Remove方法的具体用法?C# BindingElementCollection.Remove怎么用?C# BindingElementCollection.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BindingElementCollection的用法示例。


在下文中一共展示了BindingElementCollection.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryCreate

 internal static bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
 {
     if (bindingElements == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
     }
     binding = null;
     ContextBindingElement element = bindingElements.Find<ContextBindingElement>();
     if ((element != null) && (element.ContextExchangeMechanism != ContextExchangeMechanism.HttpCookie))
     {
         Binding binding2;
         BindingElementCollection elements = new BindingElementCollection(bindingElements);
         elements.Remove<ContextBindingElement>();
         if (NetTcpBinding.TryCreate(elements, out binding2))
         {
             NetTcpContextBinding binding3 = new NetTcpContextBinding((NetTcpBinding) binding2) {
                 ContextProtectionLevel = element.ProtectionLevel,
                 ContextManagementEnabled = element.ContextManagementEnabled
             };
             binding = binding3;
         }
     }
     return (binding != null);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:NetTcpContextBinding.cs

示例2: TryCreate

        internal static new bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
        {
            if (bindingElements == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
            }

            binding = null;

            ContextBindingElement contextBindingElement = bindingElements.Find<ContextBindingElement>();
            if (contextBindingElement != null)
            {
                BindingElementCollection bindingElementsWithoutContext = new BindingElementCollection(bindingElements);
                bindingElementsWithoutContext.Remove<ContextBindingElement>();
                Binding wsHttpBinding;
                if (WSHttpBinding.TryCreate(bindingElementsWithoutContext, out wsHttpBinding))
                {
                    bool allowCookies = ((WSHttpBinding)wsHttpBinding).AllowCookies;
                    if (allowCookies && contextBindingElement.ContextExchangeMechanism == ContextExchangeMechanism.HttpCookie
                        || !allowCookies && contextBindingElement.ContextExchangeMechanism == ContextExchangeMechanism.ContextSoapHeader)
                    {
                        WSHttpContextBinding contextBinding = new WSHttpContextBinding((WSHttpBinding)wsHttpBinding);
                        contextBinding.ContextProtectionLevel = contextBindingElement.ProtectionLevel;
                        contextBinding.ContextManagementEnabled = contextBindingElement.ContextManagementEnabled;
                        binding = contextBinding;
                    }
                }
            }

            return binding != null;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:31,代码来源:WSHttpContextBinding.cs

示例3: TryCreate

 internal static bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
 {
     if (bindingElements == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
     }
     binding = null;
     ContextBindingElement element = bindingElements.Find<ContextBindingElement>();
     if (element != null)
     {
         Binding binding2;
         BindingElementCollection elements = new BindingElementCollection(bindingElements);
         elements.Remove<ContextBindingElement>();
         if (WSHttpBindingBase.TryCreate(elements, out binding2))
         {
             bool allowCookies = ((WSHttpBinding) binding2).AllowCookies;
             if ((allowCookies && (element.ContextExchangeMechanism == ContextExchangeMechanism.HttpCookie)) || (!allowCookies && (element.ContextExchangeMechanism == ContextExchangeMechanism.ContextSoapHeader)))
             {
                 WSHttpContextBinding binding3 = new WSHttpContextBinding((WSHttpBinding) binding2) {
                     ContextProtectionLevel = element.ProtectionLevel,
                     ContextManagementEnabled = element.ContextManagementEnabled
                 };
                 binding = binding3;
             }
         }
     }
     return (binding != null);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:WSHttpContextBinding.cs

示例4: TryCreate

        internal static new bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
        {
            if (bindingElements == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
            }

            binding = null;

            ContextBindingElement contextBindingElement = bindingElements.Find<ContextBindingElement>();
            if (contextBindingElement != null && contextBindingElement.ContextExchangeMechanism != ContextExchangeMechanism.HttpCookie)
            {
                BindingElementCollection bindingElementsWithoutContext = new BindingElementCollection(bindingElements);
                bindingElementsWithoutContext.Remove<ContextBindingElement>();
                Binding netTcpBinding;
                if (NetTcpBinding.TryCreate(bindingElementsWithoutContext, out netTcpBinding))
                {
                    NetTcpContextBinding contextBinding = new NetTcpContextBinding((NetTcpBinding)netTcpBinding);
                    contextBinding.ContextProtectionLevel = contextBindingElement.ProtectionLevel;
                    contextBinding.ContextManagementEnabled = contextBindingElement.ContextManagementEnabled;
                    binding = contextBinding;
                }
            }

            return binding != null;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:26,代码来源:NetTcpContextBinding.cs


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