Using Int32.Parse

.net, c#, types

Solution

There is no need to even to any sort of explicit conversion:

short s = 23;
int k = s;

Also, any numeric literals (without any sort of suffix) are int32s anyway.

-- Edit

The reason an explicit cast isn't required is because a `short` is always smaller than an `int`, thus a `short` will always completely fit into the size of an `int`, so no potential loss of data.

Problem

Why is there a need to convert a value (for example short) to string, and then to Int32. Why can it not be converted from short to Int 32?

Original source