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