本文整理匯總了C#中System.MulticastDelegate.BaseEquals方法的典型用法代碼示例。如果您正苦於以下問題:C# MulticastDelegate.BaseEquals方法的具體用法?C# MulticastDelegate.BaseEquals怎麽用?C# MulticastDelegate.BaseEquals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.MulticastDelegate
的用法示例。
在下文中一共展示了MulticastDelegate.BaseEquals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: KPM
/*
* Perform a slightly crippled version of
* Knuth-Pratt-Morris over MulticastDelegate chains.
* Border values are set as pointers in kpm_next;
* Generally, KPM border arrays are length n+1 for
* strings of n. This one works with length n at the
* expense of a few additional comparisions.
*/
private static MulticastDelegate KPM (MulticastDelegate needle, MulticastDelegate haystack,
out MulticastDelegate tail)
{
MulticastDelegate nx, hx;
// preprocess
hx = needle;
nx = needle.kpm_next = null;
do {
while ((nx != null) && (!nx.BaseEquals (hx)))
nx = nx.kpm_next;
hx = hx.prev;
if (hx == null)
break;
nx = nx == null ? needle : nx.prev;
if (hx.BaseEquals (nx))
hx.kpm_next = nx.kpm_next;
else
hx.kpm_next = nx;
} while (true);
// match
MulticastDelegate match = haystack;
nx = needle;
hx = haystack;
do {
while (nx != null && !nx.BaseEquals (hx)) {
nx = nx.kpm_next;
match = match.prev;
}
nx = nx == null ? needle : nx.prev;
if (nx == null) {
// bingo
tail = hx.prev;
return match;
}
hx = hx.prev;
} while (hx != null);
tail = null;
return null;
}