Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well the list is always empty to begin with, are you setting it via <code>myClass.value = new List&lt;...&gt;();</code> ? Also have you saved the serialized data in both binary and xml formats so you can verify data is actually being saved?</p> <p>Just a note as well, if you are using 2.0+ you don't have to implement ISerializable if you don't need to control the absolute serialization, you can change value to a public property and it will serialize on it's own.</p> <p>Edit: The following case seems to serialize and deserialize fine for me, I am posting this incase I am misunderstanding the question as a whole.</p> <p>Ignoring the nasty test code, hopefully this helps a little.</p> <pre><code> [Serializable] public class OType { public int SomeIdentifier { get; set; } public string SomeData { get; set; } public override string ToString() { return string.Format("{0}: {1}", SomeIdentifier, SomeData); } } [Serializable] public class MyClass : ISerializable { public List&lt;OType&gt; Value; public MyClass() { } public MyClass(SerializationInfo info, StreamingContext context) { this.Value = (List&lt;OType&gt;)info.GetValue("value", typeof(List&lt;OType&gt;)); } void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("value", Value, typeof(List&lt;OType&gt;)); } } ... var x = new MyClass(); x.Value = new OType[] { new OType { SomeIdentifier = 1, SomeData = "Hello" }, new OType { SomeIdentifier = 2, SomeData = "World" } }.ToList(); var xSerialized = serialize(x); Console.WriteLine("Serialized object is {0}bytes", xSerialized.Length); var xDeserialized = deserialize&lt;MyClass&gt;(xSerialized); Console.WriteLine("{0} {1}", xDeserialized.Value[0], xDeserialized.Value[1]); </code></pre> <p>Forgot the output..</p> <blockquote> <p>Serialized object is 754bytes</p> <p>1: Hello 2: World</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload