'Creating a custom list library in C#. How do I set the value of a specific object as "list[position] = value"?

It may be a weird question. I'm trying to create a custom list library for C#, and I'm trying to set a specific value for my list in this structure: list[position] = value.

Any help would be much appreciated, thanks!

For some context, here's how the basic structure of my list works:

public class IntList
    {
        int[] arr;
        public IntList()
        {
            arr = new int[0];
        }


        public void Add(int num)
        {
            int[] temp = new int[arr.Length + 1];
            Array.Copy(arr, temp, arr.Length);
            temp[temp.Length - 1] = num;

            arr = temp;
        }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source