Beispiel #1
0
        public void ClassNumberReadonlyArray()
        {
            var array = new ClassNumberReadonly[size];

            for (int i = 0; i < size; i++)
            {
                var tmp = new ClassNumberReadonly(0);
                array[i] = tmp;
            }
        }
Beispiel #2
0
        public void ClassNumberReadonlyList()
        {
            var list = new List <ClassNumberReadonly>();

            for (int i = 0; i < size; i++)
            {
                var tmp = new ClassNumberReadonly(0);
                list.Add(tmp);
            }
        }
Beispiel #3
0
        public void ClassNumberReadonlyArrayPool()
        {
            var arrayPool = ArrayPool <ClassNumberReadonly> .Shared;
            var array     = arrayPool.Rent(size);

            try
            {
                for (int i = 0; i < size; i++)
                {
                    var tmp = new ClassNumberReadonly(0);
                    array[i] = tmp;
                }
            }
            finally
            {
                arrayPool.Return(array);
            }
        }