[Mono-list] About Serialization
yoros@wanadoo.es
yoros@wanadoo.es
Mon, 17 Feb 2003 23:41:30 +0100
Hello,
I was testing some stuff with BinaryFormatter and saw that there is a
problem when I serialize an array of structs of objects... something
like this:
[Serializable]
public class A {
string s;
public A (string s) { this.s = s; }
}
[Serializable]
public struct B {
public A element;
}
public static void Main (string[] args) {
B[] array = new B[10];
for (int i = 0; i < 10; i++) {
array[i].element = new A("string");
}
// now serialize the array, it fails when serializing the elements
// of the array (the size and other properties are good).
}
Can anybody tell me where resides the core of the array serialization?
I know that the problem is not with structs because if I serialize B it
works perfectly.
Regards,
Pedro
--
Pedro Martinez Juliá
\ yoros@terra.es
)| yoros@wanadoo.es
/ http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information: pub 1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E 534F 588B E285 74F1 D3AC