Пример #1
0
        static void Main(string[] args)
        {
            MamaSearcher mamaSearcher = new MamaSearcher();

            mamaSearcher.Subscribe("abc", ShowPatternInfo);
            mamaSearcher.PerformSearch("oooabc");
        }
Пример #2
0
        static void Main(string[] args)
        {
            MamaSearcher mamaSearcher = new MamaSearcher();

            mamaSearcher.Subscribe("A", APattern);
            mamaSearcher.Subscribe("A", AAnotherPattern);
            mamaSearcher.PerformSearch("AB");
        }
Пример #3
0
        static void Main(string[] args)
        {
            MamaSearcher mamaSearcher = new MamaSearcher();

            mamaSearcher.Subscribe("l", PrintArgs);
            mamaSearcher.Subscribe("r", PrintArgs);

            mamaSearcher.PerformSearch("lior");
        }
Пример #4
0
        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");
        }
Пример #5
0
        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");
        }
Пример #6
0
        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");
        }