示例#1
0
 private void DoFieldsInitialisationIfOne()
 {
     if (Maker.HasMethod("FieldsInitialiser"))
     {
         Action <REPL> action;
         Maker.GetAction <REPL>("FieldsInitialiser", out action);
         if (action != null)
         {
             action(this);
         }
     }
 }
示例#2
0
        static public void MakeClass1()
        {
            SetUpTypeParser();
            MakeClass                  mc = new MakeClass(parser, LexList.Get(@"
       partial class Examples.TestClass   
       {
         public int GetTwoTimesTheInt () 
         {
           return TheInt * 2 ;
         }

         public void SetTheString ( string s )
         {
           TheString = s ; 
         }
       }"));
            Func <TestClass, int>      GetTwoTimesTheInt;
            Action <TestClass, string> SetTheString;

            mc.GetFunc <TestClass, int>(
                "GetTwoTimesTheInt", out GetTwoTimesTheInt);
            mc.GetAction <TestClass, string>(
                "SetTheString", out SetTheString);

            TestClass tc = new TestClass();

            tc.TheInt = 34;
            int i = GetTwoTimesTheInt(tc);

            if (i != 68)
            {
                MessageBox.Show("MakeClass1 error 1");
            }
            SetTheString(tc, "New string value");
            if (tc.TheString != "New string value")
            {
                MessageBox.Show("MakeClass1 error 2");
            }
        }