static void Main(string[] args)
        {
            // array of structures
            var creatures = new Creature[100];

            foreach (var c in creatures)
            {
                c.X++;
            }

            // structure of arrays
            var creatures2 = new Creatures(100);

            foreach (Creatures.CreatureProxy c in creatures2)
            {
                c.X++;
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // Arrays of Structure
            var creatures = new Creature[100];

            foreach (var c in creatures)
            {
                c.X++;
            }

            // Structure of Arrays.. Better performance
            var creatures2 = new Creatures(100);

            foreach (Creatures.CreatureProxy c in creatures2)
            {
                c.X++;
            }
        }
 public CreatureProxy(Creatures creatures, int index)
 {
     this.creatures = creatures;
     this.index     = index;
 }