As user Panagiotis Kanavos commented, an event log entry is written when Windows boots.
If you have a look in Event Viewer in the System log, you will find those entries have Event ID == 12, which is accessed in code by using the InstanceId property of an EventLogEntry (the EventID property is deprecated).
So you can get all those log entries, sort them, and get the latest one, like this:
using System;
using System.Diagnostics;
using System.Linq;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
EventLog systemLog = new EventLog("System");
var bootEntry = systemLog?.Entries.Cast<EventLogEntry>().
Where(x => x.InstanceId == 12).
OrderByDescending(x => x.TimeGenerated).
FirstOrDefault();
if (bootEntry != null)
{
Console.WriteLine("Last boot: " + bootEntry.TimeGenerated.ToString("yyyy-MM-dd HH:mm:ss"));
}
else
{
Console.WriteLine("Could not open System log or no boot event found.");
}
Console.ReadLine();
}
}
}
(Tested as working on Windows 10 20H2.)
Now, my computer has a fast SSD, and my experience of reading the event logs from an HDD is that that can be sloooooow, so you might want to get the entry in some background task.