Suppose I have a simple class like that:
public class Person {
public string name;
public int age;
public Gender gender; //enum type
//constructor
}
Is there a built-in way to parse an object of this class to a string and then, back to Person
?
I probably will implement a ToString()
myself but I'd like to know if there is something already made for this.
The string doesn't need to be comprehensible, as long as it is invertible.
Example
Person p = new Person("Bob", 12, Gender.Male);
string s = Stringify(p); //s = "Bob#12#Male"
Person c = Personify(s); //c is just like Bob