static void Main(string[] args) { MamaSearcher mamaSearcher = new MamaSearcher(); mamaSearcher.Subscribe("abc", ShowPatternInfo); mamaSearcher.PerformSearch("oooabc"); }
static void Main(string[] args) { MamaSearcher mamaSearcher = new MamaSearcher(); mamaSearcher.Subscribe("A", APattern); mamaSearcher.Subscribe("A", AAnotherPattern); mamaSearcher.PerformSearch("AB"); }
static void Main(string[] args) { MamaSearcher mamaSearcher = new MamaSearcher(); mamaSearcher.Subscribe("l", PrintArgs); mamaSearcher.Subscribe("r", PrintArgs); mamaSearcher.PerformSearch("lior"); }
static void Main(string[] args) { Action <int, string> a = ActionToPerform; MamaSearcher ms = new MamaSearcher(); ms.Subscribe("a", a); ms.Subscribe("b", a); ms.PerformSearch("kjhdb"); }
static void Main(string[] args) { MamaSearcher ms = new MamaSearcher(); ms.Subscribe("abc", ActionsToPerform.PrintIndexAtContent); ms.Subscribe("yuval", ActionsToPerform.PrintIndexAtContent); ms.Subscribe("assa", ActionsToPerform.PrintIndexAtContent); ms.Subscribe("amit", ActionsToPerform.PrintIndexAtContent); ms.PerformSearch("amitassa"); }
static void Main(string[] args) { Action <int, string> FirstAction = Output; Action <int, string> SecondAction = MagicFound; Dictionary <string, Action <int, string> > stock = new Dictionary <string, Action <int, string> >() { { "yasha", SecondAction }, { "b", FirstAction } }; MamaSearcher mamaSearcher = new MamaSearcher(stock); mamaSearcher.PerformSearch("my name is yasha"); mamaSearcher.PerformSearch("my name is bob"); }