A
A
Alexander Alexandrovich2014-03-25 18:33:06
C++ / C#
Alexander Alexandrovich, 2014-03-25 18:33:06

How to add element to mono array?

Hello, I'm using Xamarin (Mono) and can't figure out how to add an element to an array.
If it worked in VS, then there were no problems, just Array.Add , and it won’t work like that.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2014-03-25
Protko @Fesor

Um... Array or ArrayList? if the latter then yes, Add (or whatever). If Array then Array.Resize() and then add the value...

K
kosmos89, 2014-03-25
@kosmos89

An Array cannot resize itself (except in the manner specified by @Fesor . If resizing is required, use List<T>e.g.

E
Eugene, 2014-03-26
@r4tz52

Manually increase the size of the array and set the last element. Mono does not implement functions like Array.Add(), Array.Insert(), Array.RemoveAt(), etc.
Better use lists, it's easier and more correct.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question