Which of these conversions in C# requires an explicit cast?
Correct answer B. double to int
C# allows implicit numeric conversions only when no information can be lost in magnitude, such as int to long, int to double or byte to int. Converting double to int may lose the fractional part and can overflow, so you must write (int)d. The cast truncates towards zero, so (int)3.99 gives 3 and (int)-3.99 gives -3.
Answer checked How we write and check questions
Discussion