示例#1
0
        static void Main(string[] args)
        {
            TestRoslyn tr = new TestRoslyn();

            tr.Test = "this was set from main program ";
            tr.test();
            System.Console.WriteLine(tr.Test);
            tr.Test = "this was set from main program for eval";
            Eval e = new Eval();

            e.create <TestRoslyn>(tr);
            e.eval("Test = Test + \" AND THIS WAS SET FROM Eval()\";");
            System.Console.WriteLine(tr.Test);
            string a = e.eval <string>("string a = \"return this from eval\";a");

            System.Console.WriteLine(a);
            tr.Test = "now return this";
            string b = e.eval <string>("string a = Test + \" ... and this\";a");

            System.Console.WriteLine(b);
            double d = e.eval <double>("double dbl = 1.2345*3;dbl");

            System.Console.WriteLine(d);
            e.eval("string testIt(string a){return \"testIt(): \"+a+\"\";}");
            string c = e.eval <string>("string c = testIt(\"nice\");c");

            System.Console.WriteLine(c);
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            TestRoslyn tr = new TestRoslyn();

            tr.Test = "this was set from main program ";
            tr.test();
            System.Console.WriteLine(tr.Test);
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            TestRoslyn tr = new TestRoslyn();

            tr.Test = "this was set from main program ";
            tr.test();
            System.Console.WriteLine(tr.Test);
            tr.Test = "this was set from main program for eval";
            Eval.eval <TestRoslyn>("Test = Test + \" AND THIS WAS SET FROM Eval()\";", tr);
            System.Console.WriteLine(tr.Test);
            string a = Eval.evalRet <TestRoslyn, string>("string a = \"return this from eval\";a");

            System.Console.WriteLine(a);
            tr.Test = "now return this";
            string b = Eval.evalRet <TestRoslyn, string>("string a = Test + \" ... and this\";a", tr);

            System.Console.WriteLine(b);
            double d = Eval.evalRet <TestRoslyn, double>("double dbl = 1.2345*3;dbl");

            System.Console.WriteLine(d);
            Console.ReadKey();
        }