Hello. I'm prototyping an app and have the dilemma on which format to use for returning serialized entities and collections from my WebMethods:
-
MemoryStream stream = new MemoryStream();
BinaryFormatter fmt = new BinaryFormatter();
fmt.Serialize(stream, obj);
string s = System.Convert.ToBase64String(stream.GetBuffer());
-
string s = String.Empty;
if (obj is IEntity2) ((IEntity2)obj).WriteXml(out s);
else if (obj is IEntityCollection2) ((IEntityCollection2)obj).WriteXml(out s);
Surprisingly, the binary output seems to be 10-15% larger, but I'm not sure what is faster. What is the forum's experience with a production system?
Otis, what is your suggestion?