So i have this object output
object output = new[] { "string1", "string2", "string3" };
but later down the line i want to append "string4"
to it.
So i tried:
output.Add("string4");
but I'm getting a 'object' does not contain a definition for 'Add'
so i tried the following:
((Array) output).Add("string4"); // also does not contain a definition for 'Add'
((List<string>) output).Add("string4"); // which gets rid of the red lines, but will this work with the initial contents of output?
I am not able to change the initialization. So I'm wondering if there is a cleaner way to do this. Thanks!