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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
signed (
int/shortetc, rather thatuint/ushort) have the advantage of being CLS compliant, so that is recommended unless you have a good reason.Re
intvsshort– in most cases it is more efficient to compute withint(oruint), since all the operators are optimised for this. If you are only storing and retrieving it then this isn’t an issue, of course.