Which type should you choose?

You need to identify a type that meets the following criteria:
Is always a number.
Is not greater than 65,535. Which type should you choose?

You need to identify a type that meets the following criteria:
Is always a number.
Is not greater than 65,535. Which type should you choose?

A.
System.UInt16

B.
int

C.
System.String

D.
System.IntPtr

Explanation:
System.UInt16 is the most efficient type for storing positive whole numbers up to 65,536.
An int type could be used but it is a lot wider than necessary. System.String is intended for storing immutable strings. System.IntPtr is a pointer to a memory address and it’s size is determined by the runtime platform. It is primarily used for interoperation.



Leave a Reply 1

Your email address will not be published. Required fields are marked *