private void WriteArray(IDataWriter writer, object o) { Array array = o as Array; writer.WriteArrayLength(array.LongLength); for (int i = 0; i < array.Length; i++) { SerializeItem(writer, array.GetValue(i)); } }
private void WriteList(IDataWriter writer, object o) { var list = o as IList; writer.WriteArrayLength(list.Count); for (int i = 0; i < list.Count; i++) { SerializeItem(writer, list[i]); } }
private void WriteDictionary(IDataWriter writer, object o) { var dictionary = o as IDictionary; writer.WriteArrayLength(dictionary.Count); foreach (var key in dictionary.Keys) { var value = dictionary[key]; writer.WriteStartNode(ItemName); SerializeItem(writer, key, "Key"); SerializeItem(writer, value, "Value"); writer.WriteEndNode(ItemName); } }