using System.Collections.Generic;
public static class Program
public static void Main()
string s = "A lot, of text, with commas, here and,there";
int[] result = s.AllIndexesOf(",").ToArray();
foreach (int index in result)
Console.Write(index + "\t");
public static IEnumerable<int> AllIndexesOf(this string str, string searchstring)
int minIndex = str.IndexOf(searchstring);
minIndex = str.IndexOf(searchstring, minIndex + searchstring.Length);