A
A
andrey_levushkin2020-05-26 21:44:51
.NET
andrey_levushkin, 2020-05-26 21:44:51

How to correctly add an element to an array?

For the function to work, you need to pass an array to it in this form: But in this case, the elements are added to it immediately. What if I need to fill this array with 0? Let's say I have a file with numbers, I go through each line, convert the line to a number. And how do I write this number into an existing array?
var ids = new long[] { 181105378, 252264908 };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2020-05-26
@andrey_levushkin

Use List. And if you really need an array, then List can then be converted to an array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question