After googling I've learned that it's not possible unless you do it manually. Take this code for example:
public struct SEverything
{
public int[] arrayOfHouseNumbers;
public string nameOfOwner;
}
I only know of a very cumbersome way to copy it and that's to create a new struct and do it like this:
private void CopySEverything()
{
sEverythingCopy = new SEverything();
sEverythingCopy.nameOfOwner = sEverythingOriginal.nameOfOwner;
sEverythingCopy.arrayOfHouseNumbers = new
int[sEverythingOriginal.arrayOfHouseNumbers.Length];
for (int i = 0; i < sEverythingCopy.Length; i++)
{
sEverythingCopy[i] = sEverythingOriginal[i];
}
}
I'm using a much more complicated struct and it would be really annoying to do the above for a big struct, not to mention that if the structure of the struct is changed, the code has to be rewritten. Any advice is very welcome.
e: is serializing and deserializing a good option?