示例#1
0
        public void ClassicWithRefArray()
        {
            RefType val = new RefType(10);

            for (int i = 0; i < 10; i++)
            {
                if (i == 0)
                {
                    FooClassicWithArray.BarObject(val);
                }
                else if (i == 1)
                {
                    FooClassicWithArray.BarObject(val, val);
                }
                else if (i == 2)
                {
                    FooClassicWithArray.BarObject(val, val, val);
                }
                else if (i == 3)
                {
                    FooClassicWithArray.BarObject(val, val, val, val);
                }
                else if (i == 4)
                {
                    FooClassicWithArray.BarObject(val, val, val, val, val);
                }
                else if (i == 5)
                {
                    FooClassicWithArray.BarObject(val, val, val, val, val, val);
                }
                else if (i == 6)
                {
                    FooClassicWithArray.BarObject(val, val, val, val, val, val, val);
                }
                else if (i == 7)
                {
                    FooClassicWithArray.BarObject(val, val, val, val, val, val, val, val);
                }
                else if (i == 8)
                {
                    FooClassicWithArray.BarObject(val, val, val, val, val, val, val, val, val);
                }
                else if (i == 9)
                {
                    FooClassicWithArray.BarObject(val, val, val, val, val, val, val, val, val, val);
                }
            }
        }
示例#2
0
 //[Benchmark]
 public void ClassicWithObjectArray()
 {
     for (int i = 0; i < 10; i++)
     {
         if (i == 0)
         {
             FooClassicWithArray.BarObject(null);
         }
         else if (i == 1)
         {
             FooClassicWithArray.BarObject(null, null);
         }
         else if (i == 2)
         {
             FooClassicWithArray.BarObject(null, null, null);
         }
         else if (i == 3)
         {
             FooClassicWithArray.BarObject(null, null, null, null);
         }
         else if (i == 4)
         {
             FooClassicWithArray.BarObject(null, null, null, null, null);
         }
         else if (i == 5)
         {
             FooClassicWithArray.BarObject(null, null, null, null, null, null);
         }
         else if (i == 6)
         {
             FooClassicWithArray.BarObject(null, null, null, null, null, null, null);
         }
         else if (i == 7)
         {
             FooClassicWithArray.BarObject(null, null, null, null, null, null, null, null);
         }
         else if (i == 8)
         {
             FooClassicWithArray.BarObject(null, null, null, null, null, null, null, null, null);
         }
         else if (i == 9)
         {
             FooClassicWithArray.BarObject(null, null, null, null, null, null, null, null, null, null);
         }
     }
 }