public SearchContentsAlgorithms(AsciiStringSearchAlgorithm asciiStringSearchAlgo, UTF16StringSearchAlgorithm utf16StringSearchAlgo) { if (asciiStringSearchAlgo == null) throw new ArgumentNullException("asciiStringSearchAlgo"); if (utf16StringSearchAlgo == null) throw new ArgumentNullException("utf16StringSearchAlgo"); _asciiStringSearchAlgo = asciiStringSearchAlgo; _utf16StringSearchAlgo = utf16StringSearchAlgo; }
private static int PerformSearch(SafeHeapBlockHandle textBlock, AsciiStringSearchAlgorithm algo, int repeat) { int matchCount = 0; for (var i = 0; i < repeat; i++) { matchCount = algo.SearchAll(textBlock.Pointer, (int)textBlock.ByteLength).Count(); } return matchCount; }