I’m basically saving and loading values into an array to feed into a JSON library, and I’m just looking for a more elegant way to do this:
class properties to array
return new object[] { path, pathDir, name };
array to class properties
c.path = values[0];
c.pathDir = values[1];
c.name = values[2];
Simple solutions that ideally do not require additional run time overheads such as Reflection are appreciated.
Can I do something like this?
c.{path, pathDir, name} = values[0...2]
Edit: I’m specifically asking for arrays. I know about serialization and JSON and Protobuf and everything else everyone is suggesting.
Would this not do the trick?
Edit: