Because the first test is a list of arrays. Arrays are reference types and the only way for first[0]
to be equal to second[0]
is if they are the same object. Reference types follow reference semantics meaning 2 objects are equal only if they are the same object.
In the second test you are using the same array in both lists. Since first[0]
is the same array/object as second[0]
then they are equal. You can confirm they are the same object by changing an element (e.g. arr[1]
to 10
). Both lists will see the change because they both have the same object in their list.
Refer to the docs here on how equality works in .NET.