/ Published in: C#

Serializes an object to a Base64 string. The first few characters of the serialized string indicate the byte length of the encoded data.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static string SerializeBase64(object o) { // Serialize to a base 64 string byte[] bytes; long length = 0; sf.Serialize(ws, o); length = ws.Length; bytes = ws.GetBuffer(); string encodedData = bytes.Length + ":" + Convert.ToBase64String(bytes, 0, bytes.Length, Base64FormattingOptions.None); return encodedData; }
Comments
