C# - Cast a byte array to an array of struct and vice-versa (reverse)
问题 I would like to save a Color[] to a file. To do so, I found that saving a byte array to a file using "System.IO.File.WriteAllBytes" should be very efficient. I would like to cast my Color[] (array of struct) to a byte array into a safe way considering: Potential problem of little endian / big endian (I think it is impossible to happen but want to be sure) Having 2 differents pointer to the same memory which point to different type. Does the garbage collection will know what to do - moving