當前位置: 首頁>>代碼示例>>C#>>正文


C# NetNamedPipeBinding.IsBindingElementsMatch方法代碼示例

本文整理匯總了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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:60,代碼來源:NetNamedPipeBinding.cs

示例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;
        }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:47,代碼來源:NetNamedPipeBinding.cs


注:本文中的System.ServiceModel.NetNamedPipeBinding.IsBindingElementsMatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。