c# - How does Array.Reverse work? -


i have simple piece of code..

bool istrue(char[] number) {     char[] reverse = number;     array.reverse(reverse); } 

when debugging application saw number reversed too. can explain me why? related how char arrays work, or missing something?

with

char[] reverse = number; 

you not creating copy of array, reference it.

if want copy array, can use .clone():

char[] reverse = number.clone(); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -