public void WriteDataAsync(AmfWriter writer, object obj) { var externalizable = obj is IExternalizable; // if IExternalizable then use those methods, even if it is a collection if (!externalizable) { IDictionary <string, object> stringDictionary; IDictionary dictionary; IEnumerable enumerable; if ((stringDictionary = obj as IDictionary <string, object>) != null) { writer.WriteMarkerAsync(Amf3TypeMarkers.Array); writer.WriteAmf3AssociativeArrayAsync(stringDictionary); return; } if ((dictionary = obj as IDictionary) != null) { writer.WriteMarkerAsync(Amf3TypeMarkers.Dictionary); writer.WriteAmf3DictionaryAsync(dictionary); } if ((enumerable = obj as IEnumerable) != null) { writer.WriteMarkerAsync(Amf3TypeMarkers.Array); writer.WriteAmf3ArrayAsync(enumerable.Cast <object>().ToArray()); return; } } writer.WriteMarkerAsync(Amf3TypeMarkers.Object); writer.WriteAmf3ObjectAsync(obj); }
public void WriteDataAsync(AmfWriter writer, object obj) { writer.WriteMarkerAsync(Amf3TypeMarkers.Array); writer.WriteAmf3ArrayAsync(obj as Array); }