D
D
Dmitry Korolev2016-12-26 00:31:54
C++ / C#
Dmitry Korolev, 2016-12-26 00:31:54

How to decrease the length of an array element by 1?

directoryFile[i][directoryFile[i].Length - 1] = directoryFile[i][directoryFile[i].Length - 1];
it will be a decrease in the length of the array?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2016-12-26
@adressmoeistranici

Do you need to reduce the length of the ELEMENT of the array or the length of the array?
Either way, the code above will do neither.
An array cannot be reduced in length in c# - its length is set when memory is allocated. The length can be changed for other data structures, such as List. And there is a Remove method for that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question