c# - Move 2 dimensional array lines one level lower -


i've got 2 dimensional array looks sth that:

1 2 3 4 5 6 7 8 9 

i'd copy every line 1 level lower, generating new first 1 method, this:

x x x 1 2 3 4 5 6 

the last line before copying deleted. there better way copying new array , copying original one?

you can move values without create temporary array:

for (int j = arr.getlength(1) - 1; j > 0 ; j--)   // replaces values       (int = 0; < arr.getlength(0); i++)    // of each row           arr[i, j] = arr[i, j - 1];                // previous row values 

then, copy new values:

for (int = 0; < arr.getlength(0); i++)     arr[i, 0] = /* new row values */ 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -