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


C# MulticastDelegate.BaseEquals方法代碼示例

本文整理匯總了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;
		}
開發者ID:calumjiao,項目名稱:Mono-Class-Libraries,代碼行數:55,代碼來源:MulticastDelegate.cs


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