This is my code:
byte[] base64String = //this is being set properly
var base64CharArray = new char[base64String.Length];
Convert.ToBase64CharArray(base64String,
0,
base64String.Length,
base64CharArray,
0);
var Base64String = new string(base64CharArray);
When i run this, I get the following error when calling Convert.ToBase64CharArray
:
Either offset did not refer to a position in the string, or there is an insufficient length of destination character array. Parameter name: offsetOut
How do i fix this, so i can convert my byte array to a string, or is there a better way to convert a byte array to a string?