How to circumvent this strange boolean array behaviour?

I’m trying to use a boolean array for some initialization and I ran into something I find rather misleading:

bool boolA = false;
bool boolB = boolA;
boolB = true;
Debug.Log(boolB + ", " + boolA); // Prints "True, False"

bool[] arrayBoolA = new bool[] { false };
bool[] arrayBoolB = arrayBoolA;
arrayBoolB[0] = true;
Debug.Log(arrayBoolB[0] + ", " + arrayBoolA[0]); // Prints "True, True"

For some reason in the second test, the boolean array seems to behave as if it was declared by reference, can someone clarify this point?

Array variables are reference types. When you execute arrayBoolB = arrayBoolA you’re setting arrayBoolB to the same pointer/reference as arrayBoolA. So when you change the contents of either array they’ll both have the same values because they’re both referencing the same memory.

If you want a completely separate array you should be able to use Array.Copy to copy the contents into a different reference to the same type of array.