C#获取http图片

public    Image  GetHttpImage(string url)
        {
            
            var client = new HttpClient();

            var uri = new Uri(Uri.EscapeUriString(url));
            byte[] urlContents =   client.GetByteArrayAsync(uri).Result;

            using (var ms = new System.IO.MemoryStream(urlContents))
            {
                return Image.FromStream(ms);
            }
        }

 

上一篇:Hadoop Hdfs常用命令


下一篇:URL URI傻傻分不清楚,dart告诉你该怎么用