D
Daniel Billingsley
Is there any significant difference between
int variable1 = (int) variable2;
and
int variable1 = Convert.ToInt32(variable2);
It seems like the extra typing and granularity of .ToInt32 vs. .ToInt64 etc.
is a bit of overkill for most situations compared to the very simple and
straightforward cast. Is the IL the same anyway, but the compiler has to do
a little more work in the first case to figure out the conversion to use?
int variable1 = (int) variable2;
and
int variable1 = Convert.ToInt32(variable2);
It seems like the extra typing and granularity of .ToInt32 vs. .ToInt64 etc.
is a bit of overkill for most situations compared to the very simple and
straightforward cast. Is the IL the same anyway, but the compiler has to do
a little more work in the first case to figure out the conversion to use?