You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be a significant lift to add support for the MemoryPackUnion tag to non-abstract base classes? I've got a class hierarchy where there are specialized instances of a general class of objects, and often collections keep track of the general class of objects without worrying about the special instances. For example:
public class Employee {
public string FirstName {get; set;}
public string LastName {get; set;}
public float Salary {get; set;}
}
public class Manager : Employee {
public List Reports {get; set;}
}
public class Team {
public List Members {get; set;}
}
If I serialize a team where some members are employees, but some are employees who are also managers, when I deserialize, my list will only consist of employees, no managers anymore, because there's no way to add polymorphism.
It'd be possible to work around this by creating an IEmployee interface, but I'm working in a large code base where substituting all such usages would be a fair bit of manual labor, and also reduce the readability of the code only to serve the needs of MemoryPack and not the program's overall architecture.
If this solution is reasonable architecturally, I can contribute to implementation.
The text was updated successfully, but these errors were encountered:
Would it be a significant lift to add support for the MemoryPackUnion tag to non-abstract base classes? I've got a class hierarchy where there are specialized instances of a general class of objects, and often collections keep track of the general class of objects without worrying about the special instances. For example:
public class Employee {
public string FirstName {get; set;}
public string LastName {get; set;}
public float Salary {get; set;}
}
public class Manager : Employee {
public List Reports {get; set;}
}
public class Team {
public List Members {get; set;}
}
If I serialize a team where some members are employees, but some are employees who are also managers, when I deserialize, my list will only consist of employees, no managers anymore, because there's no way to add polymorphism.
It'd be possible to work around this by creating an IEmployee interface, but I'm working in a large code base where substituting all such usages would be a fair bit of manual labor, and also reduce the readability of the code only to serve the needs of MemoryPack and not the program's overall architecture.
If this solution is reasonable architecturally, I can contribute to implementation.
The text was updated successfully, but these errors were encountered: