+ 1
Array
How to create an array with an indefinite number of variables in C#?
2 Respostas
+ 1
You cannot.
You need to define the size of an array upon declaration.
That the nature of a array.
https://www.tutorialspoint.com/csharp/csharp_arrays.htm
If you need to have list without a predefined size use a "list".
https://csharp-station.com/Tutorial/CSharp/Lesson20
+ 1
Simple, you create a list!
using System.Collections.*;
List<datatype> indefinite = new List<datatype>();
indefinite.Add("test");
indefinite.Add("test2");
Replace <datatype> with the datatype of your choice!
You can than remove, reverse, sort and use useful methods such as contains, ToArray, Exists etc