using System.Net.Http; HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync("https://example.com");
using System.Net.Http; HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync("https://example.com"); string content = await response.Content.ReadAsStringAsync();In this example, we first send an HTTP GET request using HttpClient. We then use the Content property of the HttpResponseMessage object to get a HttpContent object representing the response body. We use the ReadAsStringAsync method to read the body as a string. The System.Net.Http namespace contains classes for working with HTTP requests and responses, as well as related classes for working with network protocols.