Пример #1
0
        static private string BuildObjectString(object source, bool withBinaryFormatter)
        {
#if !SILVERLIGHT
            BaseTransfer transfer = withBinaryFormatter ? new BinaryTransfer() : (BaseTransfer) new XmlTransfer();
            return(Encoding.UTF8.GetString(transfer.ToBytes(source)));
#else
            BaseTransfer transfer = new JsonTransfer();
            var          chars    = transfer.ToBytes(source);
            return(Encoding.UTF8.GetString(chars, 0, chars.Length));
#endif
        }