PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

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.

One Comment on “Which type should you choose?


Leave a Reply