I'm writing a client-server application. I want to send DataTable table
where most of columns are of type Pair. I have that public class Pair
inside public class Struct
on both Server and Client.
[Serializable]
public class Struct
{
public class Pair
{
public int a { get; set; }
public int b { get; set; }
...
public override string ToString()
{
return this.a.ToString() + " " + this.b.ToString();
}
}
...
}
I send it from server:
(new BinaryFormatter()).Serialize(nStream, table);
Accept on client:
DataTable table = (DataTable)(new BinaryFormatter()).Deserialize(nStream);
And here I get a
TargetInvocationException "Exception has been thrown by the target of an invocation" with InnerException: ArgumentException "Column requires a valid DataType".
How to send this table over network and deserialize it?