Monday, September 18, 2006

.NET : Value Types

@ Built-In types are base types provided with the .NET Framework, with which other types are built.

@ Value types directly contain their data, offering excellent performance. However, value types are limited to types that store very small pieces of data. In the .NET Framework, all value types are 16 bytes or shorter.

@ All build-in numeric types are value types.

@ For integral variables, use Int32 and UInt32, because the runtime optimizes the performance of 32-bit integer types (System.Int32 and System.UInt32).
@ For floating-point operations, System.Double is the most efficient type, because those operations are optimized by hardware.

@ User-Defined types are also called structures. Structures are a composite of other types that make it easier to work with related ata.

@ Instances of User-Defined types are stored on the stack and they contain their data directly.

@ In most ways, structures behave nearly identical to classes. While the functionality is similar, structures are usually more efficient than classes.

@ Enumerations are related symbols that have fixed values. Use enumerations to provide a limited set of of choices for a value. For example:

Enum Titles As Integer
Mr
Ms
Mrs
Dr
End Enum

@ The purpose of enumerations is to simplify coding and improve code readability by enabling you to use meaningful symbols instead of simple numeric values.