//this metthid will populate both lists in order to show and cut down the runtime // runs im O(n^2) time public List <string> PopulateContentLists() { List <string> lstReleases = new List <string>(); var stream = objData.CreateLink(); // assigning the object to a local variable while (!stream.EndOfStream) { String line = stream.ReadLine(); //var val = line.Split(','); string patt = @",(\d{4}),"; //string patst = @"(\d{3} min)|(\d{2} min)|(\d[0-2] Season)"; foreach (var item in lstMovies) { MatchCollection matches = Regex.Matches(item, patt); foreach (Match m in matches) { string cleaned = m.ToString().Replace(",", ""); if (lstReleases.Contains(cleaned)) { } else { lstReleases.Add(cleaned); } } } if (line.Contains(",Movie")) { lstMovies.Add(line); } else { lstShows.Add(line); } } lstReleases.Sort(); return(lstReleases); }