SYSLIB0014: WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete
Here is a basic replacement for WebClient using HttpClient:
public async Task<string?> ReadString()
{
using HttpClient httpClient = new HttpClient();
var _baseUrl = $"https://myjsonwebserver.com.br/";
var response = await httpClient.GetAsync(_baseUrl);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
return result;
}
return null;
}
I hope this helps you or myself in the future.