private void buttonCalculate_Click(object sender, EventArgs e) { var cdoc = new CalcDaysOldClient(); var bornday = DateTime.ParseExact(textBoxBirthdate.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); labelResult.Text = cdoc.daysOld(bornday).ToString(); }
static void Main(string[] args) { CalcDaysOldClient cdoc = new CalcDaysOldClient(); Console.WriteLine("Welcome, want to know how many days old you are? \r\nPlease input the date you where born dd.MM.yyyy"); DateTime bornday = DateTime.ParseExact(Console.ReadLine(), "dd.MM.yyyy", CultureInfo.InvariantCulture); Console.WriteLine(cdoc.daysOld(bornday)); Console.ReadKey(); }