c# - How to convert Icon into a base64 string? -
icon icon = icon.extractassociatedicon(_path);
how convert above icon
base64 string in c# ?
first have raw bytes of icon:
var icon = icon.extractassociatedicon(_path); byte[] bytes; using (var ms = new memorystream()) { icon.save(ms); return ms.toarray(); }
then can convert bytes base64 string:
var base64string = convert.tobase64string(bytes);
Comments
Post a Comment