private void WriteToStream(object value, Stream writeStream) { IEnumerable <Representation> list = value as IEnumerable <Representation>; if (list != null) { List <Representation> newList = list.ToList(); newList.ForEach(this.Prepare); this.WriteObject(newList, writeStream); } else { Representation representation = value as Representation; this.Prepare(representation); this.WriteObject(value, writeStream); } }
protected virtual void Prepare(Representation representation) {}
protected virtual void Prepare(Representation representation) { }