I am new to C#. Is any one know how to add a series numbers via Console.Write to an open ended array? I think a while loop could accomplish that when sentinel value entered but having trouble to do so:). Thanks!
Adding values to an open ended array
Collapse
X
-
-
I'm not sure what you mean by open-ended array.
Arrays in C# have defined lengths. What you might want is a List. If these are numbers, you would use List<int> or List<double>.
Something like this:
And you can get a fixed length array from the list once you are done.Code:List<int> lst = new List<int>(); int i = 20; lst.Add(i);
Hope that helps.Comment
Comment