コード例 #1
0
        private static void TestRefClass1(ref object c)
        {
            ClassWithOneField c1 = (ClassWithOneField)c;

            c1.x = 100;
            c    = new object();
        }
コード例 #2
0
        public static int NewObjAndDup()
        {
            ClassWithOneField classWithOneField = new ClassWithOneField();

            classWithOneField.x = 42;
            ReturnConstant();
            return(classWithOneField.x);
        }
コード例 #3
0
        public static int TestRefClass()
        {
            var c = new ClassWithOneField()
            {
                x = 56
            };

            TestRefClass(ref c);
            return(c.x);
        }
コード例 #4
0
        public static int TestRefClass1()
        {
            var c = new ClassWithOneField()
            {
                x = 56
            };
            object o = c;

            TestRefClass1(ref o);
            return(c.x);
        }
コード例 #5
0
        public static void NewObj1()
        {
            object c = new ClassWithOneField();

            for (int i = 0; i < 2; i++)
            {
                var x = new int[32];
            }

            var y = new double[32];
            var z = new double[32];
        }
コード例 #6
0
        public static int LdelemaTest1()
        {
            var array = new ClassWithOneField[] { new ClassWithOneField()
                                                  {
                                                      x = 56
                                                  }, new ClassWithOneField()
                                                  {
                                                      x = 42
                                                  } };

            TestRefClass(ref array[0]);
            return(array[0].x);
        }
コード例 #7
0
        public static ClassWithOneField NewObjWithBranching(bool f)
        {
            ClassWithOneField classWithOneField = new ClassWithOneField();

            if (f)
            {
                classWithOneField.x = 42;
            }
            else
            {
                classWithOneField.x = 456;
            }
            return(classWithOneField);
        }
コード例 #8
0
        public static void NewObjInLoop1()
        {
            object c = new ClassWithOneField();

            SequentialNewClassesWithOneField();
            for (int i = 0; i < 5; ++i)
            {
                new object();
            }

            if (c is string)
            {
                new object();
            }
        }
コード例 #9
0
        public static void LdelemaTest2(bool f)
        {
            var array = new ClassWithOneField[] { new ClassWithOneField()
                                                  {
                                                      x = 56
                                                  }, new ClassWithOneField()
                                                  {
                                                      x = 42
                                                  } };

            if (f)
            {
                object[] objectArray = array;
                TestRefClass2(ref objectArray[0]);
            }
        }
コード例 #10
0
        public static int TestCompositionWhenCallDividesBlocksAndSomeInformationIsPropagated()
        {
            object c = new ClassWithOneField();

            for (int i = 0; i < 2; i++)
            {
                var x = new int[32];
            }

            var y = new double[32];
            var z = new double[32];

            ReturnConstant();

            return(y.Length + z.Length);
        }
コード例 #11
0
        public static int TestAllocatedType_4(bool f)
        {
            ClassWithOneField classWithOneField;
            int result = 0;

            if (f)
            {
                classWithOneField   = new ClassWithOneField();
                classWithOneField.x = 100;
                result = classWithOneField.x;
            }
            else
            {
                result = 42;
            }

            return(result);
        }
コード例 #12
0
        public static int ReadFieldOfCLass1(ClassWithOneField a, ClassWithOneField b)
        {
            var c1 = new ClassWithOneField();

            c1.x = 42;
            var c2 = new ClassWithOneField();

            c2.x = 12;
            var c3 = new ClassWithOneField();

            c3.x = 7;
            a.x  = b.x * 2;
            if (a.x > 127)
            {
                b.x = a.x * 2;
            }
            return(a.x);
        }
コード例 #13
0
 public static int NRE_TEST(ClassWithOneField c)
 {
     return(c.x);
 }
コード例 #14
0
        private static void TestRefClass2(ref object c)
        {
            ClassWithOneField c1 = (ClassWithOneField)c;

            c1.x = 100;
        }
コード例 #15
0
 private static void TestRefClass(ref ClassWithOneField c)
 {
     c = new ClassWithOneField();
 }
コード例 #16
0
 private static int ReadFieldOfCLass(ClassWithOneField classWithOneField)
 {
     return(classWithOneField.x);
 }