What is the error in below code? Why can't I convert it to int | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
- 1

What is the error in below code? Why can't I convert it to int

int age=0; age=Convert.ToInt32(DateTime.Now-this.dateOfBirth);

4th Apr 2020, 3:42 PM
amith
2 ответов
0
public int CalculateAge() { int age=0; age = Convert.ToInt32(DateTime.Now-this.dateOfBirth); return age; } this.dateOfBirth is a parameter passed to Constructor
4th Apr 2020, 4:32 PM
amith
- 1
hey amith if you don't mind showing the piece of code at large that might help clear somethings
4th Apr 2020, 4:21 PM
✳AsterisK✳
✳AsterisK✳ - avatar