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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With