c# - Convert.ToBase64String() with numbers larger than 255 -


i'm using code below convert list of numbers base64 encoded string.

the problem try on 255 system.overflowexception since overflows byte capacity.

what way of doing this? there example here wondering if there other ways of making work.

private string decimaltobase64(list<int> lst) {     byte[] arr = new byte[lst.count];      for(int = 0; < arr.length; i++)     {         arr[i] = convert.tobyte(lst[i]);     }      return convert.tobase64string(arr); } 

try code:

public static string decimaltobase64(list<int> lst) {     var bytes = new list<byte>();     foreach (var item in lst)         bytes.addrange(bitconverter.getbytes(item));     return convert.tobase64string(bytes.toarray()); } 

read more bytes order wiki


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -