如何将此system.drawing.bitmp方法从vb转换为# [英] how to convert this system.drawing.bitmp method from vb to #

查看:98
本文介绍了如何将此system.drawing.bitmp方法从vb转换为#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub SaveJPG(ByVal strJpgUrl As String, ByVal strJPGFile As String, ByVal webProxy As WebProxy)
        Dim webClient As WebClient = New WebClient()
        webClient.Proxy = webProxy
        Dim jpgFile As New System.Drawing.Bitmap(New IO.MemoryStream(webClient.DownloadData(strJpgUrl)))
        jpgFile.Save(strJPGFile)
        jpgFile = Nothing
        webClient = Nothing
    End Sub



嘿我需要一些帮助我想在c#中使用这个方法,我不能转换它



我在这里:


hey there I need some help I want to make same like this method in c # and I cant convert it

here I did :

private void SaveJPG(string strJpgUrl, string strJPGFile, WebProxy webProxy)
{
	WebClient webClient = new WebClient();
	webClient.Proxy = webProxy;
	System.Drawing.Bitmap jpgFile(MemoryStream(webClient.DownloadData(strJpgUrl)));
	jpgFile.Save(strJPGFile);
	jpgFile = null;
	webClient = null;
}

我所做的是错的我知道任何人都可以帮助我

what I did is wrong I know can any one help me please

推荐答案

你忘了一点。尝试:

You forgot a bit. Try:
private void SaveJPG(string strJpgUrl, string strJPGFile, WebProxy webProxy)
{
	WebClient webClient = new WebClient();
	webClient.Proxy = webProxy;
	System.Drawing.Bitmap jpgFile = new System.Drawing.Bitmap(new IO.MemoryStream(webClient.DownloadData(strJpgUrl)));
	jpgFile.Save(strJPGFile);
	jpgFile = null;
	webClient = null;
}


这篇关于如何将此system.drawing.bitmp方法从vb转换为#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆