'A dynamic array that changes size on one click function and being used on in another click function
I'm programming something for a school task and having a problem. I need to create an array, then I need to change its size on one-click function(the size of the array depends on the button you click, there are 3 options, each one makes a different size array) and then use it in another click functioned.
I don't know how to do it (I can't make it static because it's size needs to be changed in a click function) I thought about just creating the array in the function instead of changing its size but I can't because then I can not use it in the other function. I wanted to ask if I am able to change an outside array size in a function or create an array in a function and then use it in another one, and if I am, how?
Please help, thanks in advance
C#
Solution 1:[1]
Array not suitable for the actions you specified in the question.
Array don't have Add and Remove functional.
You can use List instead Arrays.
List is dynamic data structure and very easy to use.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
