Esempio n. 1
0
        //should not work
        public void TestExplicitDelegateStatic3()
        {
            var executor = new VaultActionExecutor();
            VaultAction <StringBuilder, string> vaDel = StaticAppendText;

            executor.ExecuteAction(vaDel, "Hi mom!");
        }
Esempio n. 2
0
        //should not work
        public void TestLambdaStatic()
        {
            var executor = new VaultActionExecutor();

            executor.ExecuteAction((ref StringBuilder sb, in string s) =>
            {
                sb.AppendLine(s);
                //correct, references "this" and "_sb"
                StaticStringBuilder = sb;
            }, "Hi mom!");
        }
Esempio n. 3
0
        //should not work
        public void TestDelegateNonStatic()
        {
            var executor = new VaultActionExecutor();

            executor.ExecuteAction(delegate(ref StringBuilder sb, in string s)
            {
                sb.AppendLine(s);
                //correct, references "this" and "_sb"
                _sb = sb;
            }, "Hi mom!");
        }
Esempio n. 4
0
        //should not work
        public void TestLocalNonStatic()
        {
            var executor = new VaultActionExecutor();

            executor.ExecuteAction(AppendText, "Hi mom!");

            void AppendText(ref StringBuilder sb, in string appendMe)
            {
                _sb = sb;
                sb.AppendLine(appendMe);
            }
        }
Esempio n. 5
0
        //should not work
        public void TestExplicitDelegateStatic2()
        {
            var executor = new VaultActionExecutor();
            VaultAction <StringBuilder, string> vaDel = (ref StringBuilder sb, in string s) =>
            {
                sb.AppendLine(s);
                //incorrect, references "this" and "_sb"
                StaticStringBuilder = sb;
            };

            executor.ExecuteAction(vaDel, "Hi mom!");
        }
Esempio n. 6
0
        public void TestNonStaticMethodGetTest()
        {
            VaultActionExecutor executor = new VaultActionExecutor();

            executor.ExecuteAction(AppendText, "Hi mom!");
        }
Esempio n. 7
0
        //should not work
        public void TestLocalStatic()
        {
            var executor = new VaultActionExecutor();

            executor.ExecuteAction(StaticAppendText, "Hi mom!");