Alex
Alex

Reputation: 77349

C#: Store byte array in XML

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

Upvotes: 21

Views: 23985

Answers (1)

Mehrdad Afshari
Mehrdad Afshari

Reputation: 422112

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.

Upvotes: 56

Related Questions