How to: Use Data Types to Define Variables in VB.NET

1 comment - This post in romanian

Data types associated to the variables establish the content of data and size of areas used to store data. In VB.NET, the following data types are available for software developer:

  • Boolean: True/False values; memory area size varies depending on platform implementation;
  • Byte: unsigned integer values; a variable of Byte type refers to a memory area of 1 byte length;
  • Char: unsigned integer values associated to symbols; the memory length is 2 bytes;
  • Date: date and time values; length of reserved memory is 8 bytes;
  • Decimal: signed real values; the memory area length is 16 bytes;
  • Double: signed real values represented in floating point, double precision; size of allocated memory area is 8 bytes;
  • Integer: signed integer values; the memory area length is 4 bytes;
  • Long: signed integer values; the memory area length is 8 bytes;
  • Object: address type values that relate objects – reference types: string, arrays, object classes, interface; length of reserved memory is 4 bytes (32-bit platform) or 8 bytes (64-bit);
  • SByte: signed integer values; the memory area length is 1 byte;
  • Short: signed integer values; the memory area length is 2 bytes;
  • Single: signed real values represented in floating point, simple precision; the memory area length is 4 bytes;
  • String: unsigned integere values associated to Unicode symbols; each Unicode symbol is reserved on 2 bytes;
  • UInteger: unsigned integer values; the memory area length is 4 bytes;
  • ULong: unsigned integer values; the memory area length is 8 bytes;
  • User-Defined: values defined by developer; length of the memory depends on members defined in User-Defined structure
  • UShort: unsigned integer values; the memory area length is 2 bytes;

Variables declared without a data type have associated default type Object. The advantage of this technique consists of writing code faster. Disadvantage is the possibility of slower execution of the application

, , , ,


  1. No comments yet.
(will not be published)