I need to serialize a class which it's source code cannot be changed (take this as a fact), and it's from a different assembly. It has only one constructor
public class MyObject
{
string _s;
int _i;
internal MyObject(string s, int i)
{
// ...
}
}
JsonConvert.SerializeObject(object) fails of course because of this. I wonder if there is a way to use Json.NET to serialize this class without having to adding code or even tags to it.
DeserializeObjectbe throwing the exception if it's related to the constructor, as this is when it has to construct the object again.MyObjectclass sealed? Can you inherit it?