如何:请求网页并以数据流的形式检索结果How to: Request a Web Page and Retrieve the Results as a Stream

此示例演示如何请求 Web 页并在流中检索结果。This example shows how to request a Web page and retrieve the results in a stream.

示例Example

var myClient = new WebClient();
Stream response = myClient.OpenRead("https://docs.microsoft.com/dotnet/");
// The stream data is used here.
response.Close();
Dim myClient As New WebClient()
Dim response As Stream = myClient.OpenRead("https://docs.microsoft.com/dotnet/")
' The stream data is used here.
response.Close()

编译代码Compiling the Code

此示例需要:This example requires:

请参阅See also