In C#, how can I get the size of a file by URL without using WebRequest? Maybe using HttpClient

I have found a ton of examples online like this:

WebRequest webRequest = WebRequest.Create(stagingFileMap.URL);
webRequest.Method = "HEAD";
var webResponse = webRequest.GetResponse();
string fileSize = webResponse.Headers.Get("Content-Length");
double fileSizeInBytes = Math.Round(System.Convert.ToDouble(fileSize), 2); // yadda yadda

This is great, except WebRequest is obsolete / deprecated. I cannot find a good example that shows how to do it using HttpClient (maybe you can't use HttpClient, I don't know).

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum