You need an array
, you can’t do it like that:
int i = 2; // get the input from somewhere
var values = new string[i];
But that doesn’t mean it’s not possible.You can even create dynamic assemblies,classes,properties,if you really want to.See this documentation for more details: Emitting Dynamic Methods and Assemblies
solved Dynamically declare string variables