C#: Store byte array in XML

2020-06-08 02:48发布

问题:

What would be a simple way to store a Byte[] array in XML (using C#) ?

回答1:

Use Convert.ToBase64String(byte[]) to convert it to base 64 representation and store the resulting string.

You can get back the byte[] by calling Convert.FromBase64String(string) method.