Пример #1
0
        public static void PregTest()
        {
            Dictionary <object, PregMatchWithOffset> matchWithOffsets;
            Dictionary <object, string> matches;
            var a = Preg.Match("/hello/i", "a Hello x", out matches, 2);
            var b = Preg.Match("/hello/i", "a Hello x");
            var c = Preg.MatchWithOffset("/hello/i", "ó Hello world", out matchWithOffsets);

            PhpDummy.echo("We have " + matchWithOffsets[0].Value + " at " + matchWithOffsets[0].Offset);
        }
Пример #2
0
        public static void Collections()
        {
            // List
            List <string> list = new List <string>();

            foreach (var i in list)
            {
                PhpDummy.echo(i);
            }
            var count = list.Count;

            // Dictionary
            Dictionary <string, string> dict = new Dictionary <string, string>();

            foreach (var i in dict)
            {
                PhpDummy.echo(i.Key + " " + i.Value);
            }
            foreach (var i in dict.Values)
            {
                PhpDummy.echo(i);
            }
            foreach (var i in dict.Keys)
            {
                PhpDummy.echo(i);
            }
            // var values = dict.Values;
            // var keys = dict.Keys;
            count = dict.Count;

            // Stack
            Stack <string> stack = new Stack <string>();

            stack.Push("X");
            stack.Push("Y");
            var s1 = stack.Peek();
            var s2 = stack.Pop();

            count = stack.Count;
        }
Пример #3
0
 public static void Hello()
 {
     PhpDummy.echo("ClassInSubfolder hello");
 }