In C #, how can I take an image from a URL and convert to System.Data.Linq.Binary

I am using a library that wants a photo in System.Data.Linq.Binary format. RIght now I only have a URL. what's the easiest way in C # to convert this link to System.Data.Linq.Binary format?

+4
source share
2 answers
byte[] raw; using(var client = new WebClient()) { // in System.Net raw = client.DownloadData(url); } var binary = new Binary(raw); // in System.Data.Linq 
+5
source

I think WebClient.DownloadData is the easiest way:

 var webClient = new WebClient(); var imageBytes = webClient.DownloadData(yourUrl); 
+1
source

Source: https://habr.com/ru/post/1345069/


All Articles