using System.Collections.Generic;
public static void Main()
string p_FieldValue = "some text before the word Smarter and some text after it. This Description contains a lot of ssssss";
string p_QueryTerms = "Strategies for Smarter Budgets and Smarter S";
IList<KeyValuePair<int, int>> result = new List<KeyValuePair<int, int>>();
string[] termsArray = p_QueryTerms.ToLower().Split(' ');
foreach (string term in termsArray) {
index = p_FieldValue.ToLower().IndexOf(term, index);
result.Add(new KeyValuePair<int, int>(index, term.Length));
result = result.Distinct().OrderBy(x => x.Key).ToList<KeyValuePair<int, int>>();
foreach (KeyValuePair<int, int> highlight in result) {
Console.WriteLine("index: " + highlight.Key + ", length: " + highlight.Value);