本文整理匯總了C#中System.ServiceModel.NetNamedPipeBinding.IsBindingElementsMatch方法的典型用法代碼示例。如果您正苦於以下問題:C# NetNamedPipeBinding.IsBindingElementsMatch方法的具體用法?C# NetNamedPipeBinding.IsBindingElementsMatch怎麽用?C# NetNamedPipeBinding.IsBindingElementsMatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ServiceModel.NetNamedPipeBinding
的用法示例。
在下文中一共展示了NetNamedPipeBinding.IsBindingElementsMatch方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TryCreate
internal static bool TryCreate(BindingElementCollection elements, out Binding binding)
{
NetNamedPipeSecurity security;
binding = null;
if (elements.Count > 4)
{
return false;
}
TransactionFlowBindingElement context = null;
BinaryMessageEncodingBindingElement encoding = null;
WindowsStreamSecurityBindingElement wssbe = null;
NamedPipeTransportBindingElement namedPipe = null;
foreach (BindingElement element5 in elements)
{
if (element5 is TransactionFlowBindingElement)
{
context = element5 as TransactionFlowBindingElement;
}
else if (element5 is BinaryMessageEncodingBindingElement)
{
encoding = element5 as BinaryMessageEncodingBindingElement;
}
else if (element5 is WindowsStreamSecurityBindingElement)
{
wssbe = element5 as WindowsStreamSecurityBindingElement;
}
else if (element5 is NamedPipeTransportBindingElement)
{
namedPipe = element5 as NamedPipeTransportBindingElement;
}
else
{
return false;
}
}
if (namedPipe == null)
{
return false;
}
if (encoding == null)
{
return false;
}
if (context == null)
{
context = GetDefaultTransactionFlowBindingElement();
}
if (!TryCreateSecurity(wssbe, out security))
{
return false;
}
NetNamedPipeBinding binding2 = new NetNamedPipeBinding(security);
binding2.InitializeFrom(namedPipe, encoding, context);
if (!binding2.IsBindingElementsMatch(namedPipe, encoding, context))
{
return false;
}
binding = binding2;
return true;
}
示例2: TryCreate
internal static bool TryCreate(BindingElementCollection elements, out Binding binding)
{
binding = null;
if (elements.Count > 4)
return false;
TransactionFlowBindingElement context = null;
BinaryMessageEncodingBindingElement encoding = null;
WindowsStreamSecurityBindingElement security = null;
NamedPipeTransportBindingElement namedPipe = null;
foreach (BindingElement element in elements)
{
if (element is TransactionFlowBindingElement)
context = element as TransactionFlowBindingElement;
else if (element is BinaryMessageEncodingBindingElement)
encoding = element as BinaryMessageEncodingBindingElement;
else if (element is WindowsStreamSecurityBindingElement)
security = element as WindowsStreamSecurityBindingElement;
else if (element is NamedPipeTransportBindingElement)
namedPipe = element as NamedPipeTransportBindingElement;
else
return false;
}
if (namedPipe == null)
return false;
if (encoding == null)
return false;
if (context == null)
context = GetDefaultTransactionFlowBindingElement();
NetNamedPipeSecurity pipeSecurity;
if (!TryCreateSecurity(security, out pipeSecurity))
return false;
NetNamedPipeBinding netNamedPipeBinding = new NetNamedPipeBinding(pipeSecurity);
netNamedPipeBinding.InitializeFrom(namedPipe, encoding, context);
if (!netNamedPipeBinding.IsBindingElementsMatch(namedPipe, encoding, context))
return false;
binding = netNamedPipeBinding;
return true;
}