本文整理汇总了C#中Registration.CheckIfCompatible方法的典型用法代码示例。如果您正苦于以下问题:C# Registration.CheckIfCompatible方法的具体用法?C# Registration.CheckIfCompatible怎么用?C# Registration.CheckIfCompatible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration.CheckIfCompatible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
// internal method to return an existing PeerNode or create a new one with the given settings
public static PeerNodeImplementation Get(Uri listenUri, Registration registration)
{
if (listenUri == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("listenUri");
if (listenUri.Scheme != PeerStrings.Scheme)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("listenUri", SR.GetString(SR.InvalidUriScheme,
listenUri.Scheme, PeerStrings.Scheme));
}
// build base uri
Uri baseUri = new UriBuilder(PeerStrings.Scheme, listenUri.Host).Uri;
lock (peerNodes)
{
PeerNodeImplementation peerNodeImpl = null;
PeerNodeImplementation peerNode = null;
if (peerNodes.TryGetValue(baseUri, out peerNode))
{
peerNodeImpl = (PeerNodeImplementation)peerNode;
// ensure that the PeerNode is compatible
registration.CheckIfCompatible(peerNodeImpl, listenUri);
peerNodeImpl.refCount++;
return peerNodeImpl;
}
// create a new PeerNode, and add it to the dictionary
peerNodeImpl = registration.CreatePeerNode();
peerNodes[baseUri] = peerNodeImpl;
peerNodeImpl.refCount = 1;
return peerNodeImpl;
}
}
示例2: Get
public static PeerNodeImplementation Get(Uri listenUri, Registration registration)
{
if (listenUri == null)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("listenUri");
}
if (listenUri.Scheme != "net.p2p")
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("listenUri", System.ServiceModel.SR.GetString("InvalidUriScheme", new object[] { listenUri.Scheme, "net.p2p" }));
}
Uri key = new UriBuilder("net.p2p", listenUri.Host).Uri;
lock (peerNodes)
{
PeerNodeImplementation peerNode = null;
PeerNodeImplementation implementation2 = null;
if (peerNodes.TryGetValue(key, out implementation2))
{
peerNode = implementation2;
registration.CheckIfCompatible(peerNode, listenUri);
peerNode.refCount++;
return peerNode;
}
peerNode = registration.CreatePeerNode();
peerNodes[key] = peerNode;
peerNode.refCount = 1;
return peerNode;
}
}