那位大侠能把这段java代码翻译成c#,很短的一段代码,百分相谢!

xfary 2007-09-04 09:51:17
package test;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.security.MessageDigest;
import sun.misc.BASE64Encoder;

public class Test1
{

/**
* @param args
*/
public static void main(String[] args)
{
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
String webAddress = "https://www.contoso.com/"
try
{ URL url = new URL(webAddress);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = in.readLine()) != null)
{
System.out.println(line);
}
in.close();

}
catch (Exception e)
{
e.printStackTrace();
}
}
}
...全文
184 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
huing 2007-09-05
  • 打赏
  • 举报
回复
webservice
绝代坏坏 2007-09-04
  • 打赏
  • 举报
回复
namespace test;

using java.io.BufferedReader;
using java.io.InputStreamReader;
using java.net.URL;
using java.security.MessageDigest;
using sun.misc.BASE64Encoder;

public class Test1
{

/**
* @param args
*/
public static void main(String[] args)
{
String webAddress = "https://www.contoso.com/"
WebClient wc=new WebClient();
Stream s= wc.OpenRead(webAddress);

try
{
StreamReader sr = new StreamReader(s);
string str1 = sr.ReadToEnd();
Consle.Write(str1);//输出网页


}
catch (Exception e)
{
e.printStackTrace();
}
}
}

创造奇迹9999 2007-09-04
  • 打赏
  • 举报
回复
up一个,不会
zxkid 2007-09-04
  • 打赏
  • 举报
回复
没用过Java 帮顶
diablo8848 2007-09-04
  • 打赏
  • 举报
回复
沙发,顶个

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧