public void Original() { var array = new int[Size]; Multiplier.PopulateMultiplesOfTwo(array); // do something with the data }
public void PopulateMultiplesOfTwo_Should_PopulateArrayWithExpectedValues() { var array = new int[5]; Multiplier.PopulateMultiplesOfTwo(array); Assert.Equal(2, array[0]); Assert.Equal(4, array[1]); Assert.Equal(6, array[2]); Assert.Equal(8, array[3]); Assert.Equal(10, array[4]); }
public void ArrayPool() { var array = ArrayPool <int> .Shared.Rent(Size); try { Multiplier.PopulateMultiplesOfTwo(array, Size); // do something with the data } finally { ArrayPool <int> .Shared.Return(array); } }