Reputation: 196499
i am using a library that wants a photo in System.Data.Linq.Binary format. RIght now i just have a URL. what is the easiest way in C# to convert this link into the System.Data.Linq.Binary format?
Upvotes: 4
Views: 3304
Reputation: 32323
I think WebClient.DownloadData
is the easiest way:
var webClient = new WebClient();
var imageBytes = webClient.DownloadData(yourUrl);
Upvotes: 1
Reputation: 1062780
byte[] raw;
using(var client = new WebClient()) { // in System.Net
raw = client.DownloadData(url);
}
var binary = new Binary(raw); // in System.Data.Linq
Upvotes: 7