I have an integer (representing seconds) which I'm converting to hours by dividing by 3600. I then store the value in a property (type int). If the value contains a decimal point, I convert it by casting. However, when I try to assign the value to the property, I get an error: "Cannot implicitly convert type 'decimal' to 'int'." Here's my code:
var p = ((Hours.Duration) / 3600.0);
(Hours.Duration) = p;
However,
Hours.Duration = (Hours.Duration) / 3600
works fine, and rounds to an int
. What am I doing wrong?