So I used a solution found on a question from a different user here, link: How do I calculate someone's age in C#?, where the DOB was hardcoded, I added the code to take in a user input from the console to then calculate the age, however I don't know why the if statement produces a correct result, without it, it calculates the age you'll be that year, not your actual age.
var today = DateTime.Today;
Console.WriteLine("Type in your D.O.B in DD-MM-YYYY format:");
var Bday = Console.ReadLine();
var myDate = Convert.ToDateTime(Bday);
var age = today.Year - myDate.Year;
if (myDate.Date > today.AddYears(-age)) age--;
Console.WriteLine($"You are {age} years old");
Console.ReadLine();
Any help will be greatly appreciated!