Should I use int or UInt16?
c#
Solution
signed (`int` / `short` etc, rather that `uint` / `ushort`) have the advantage of being CLS compliant, so that is recommended unless you have a good reason.
Re `int` vs `short` - in most cases it is more efficient to compute with `int` (or `uint`), since all the operators are optimised for this. If you are only storing and retrieving it then this isn't an issue, of course.
Problem
This may be somewhat trivial, but in C# do you prefer int or UInt16 when storing a network port in a variable? Framework classes use int when dealing with a network port although UInt16 actually represents the valid values.