I've read that Array.Clone performs shallow copy, however this code suggests that a deep copy of the original array is created i.e. any changes in cloned array are not being reflected in original array
int[] arr = new int[] { 99, 98, 92, 97, 95 };
int[] newArr = (int[])arr.Clone();
//because this is a shallow copy newArr should refer arr
newArr[0] = 100;
//expected result 100
Console.WriteLine(arr[0]);//print 99
Am i missing something obvious here ?
When copying a collection of immutable structs (primitives such as it's are immutables) there is no difference between deep and shallow copy. They are copied by value - and therefore it is as deep copy performs.
See more for the difference under: What is the difference between a deep copy and a shallow copy?