本文整理匯總了C#中System.MulticastDelegate.EqualsWithoutInvocationList方法的典型用法代碼示例。如果您正苦於以下問題:C# MulticastDelegate.EqualsWithoutInvocationList方法的具體用法?C# MulticastDelegate.EqualsWithoutInvocationList怎麽用?C# MulticastDelegate.EqualsWithoutInvocationList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.MulticastDelegate
的用法示例。
在下文中一共展示了MulticastDelegate.EqualsWithoutInvocationList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LastIndexOf
/// <summary>
/// Will return an index into [head] + tail, or -1 if not found
/// </summary>
private int LastIndexOf(MulticastDelegate o)
{
int oInvLen = o.InvocationListLength;
var oInvList = o.InvocationList;
var invList = InvocationList;
// We need to start comparing from the end.
// Mono's implementation uses the KMP algorithm, but at a first
// glance this seems to be overkill for an invocation list. In the
// typical usage scenario, 'o' will have no invocation list at all.
// We stick to the naive implementation for now.
int i = InvocationListLength - oInvLen;
if (oInvLen == 0)
{
for(; i > 0; --i)
{
if (o.EqualsWithoutInvocationList(invList[i - 1]))
return i;
}
}
else
{
for (; i > 0; --i)
{
if (!o.EqualsWithoutInvocationList(invList[i - 1]))
continue;
for (int j = 0; j < oInvLen; ++j)
{
if (!invList[i + j].EqualsWithoutInvocationList(oInvList[j]))
goto next_iteration;
}
// found it!
return i;
next_iteration:;
}
}
// 0 = this
return i < 0 || !o.EqualsWithoutInvocationList(this) ? -1 : 0;
}