8. Most Common data types in visual studio.
The data type of a programming element refers to what kind of data it can hold and how it stores that data. Data types apply to all values that can be stored in computer memory or participate in the evaluation of an expression. Every variable, literal, constant, enumeration, property, procedure parameter, procedure argument, and procedure return value has a data type.
The two fundamental data types in Visual studio are value types and reference types. Primitive types (except strings), enumerations, and structures are value types. Classes, strings, standard modules, interfaces, arrays, and delegates are reference types. Every type has a default value. Reference types are created on the Heap. The lifetime of the reference type is managed by the .NET framework. The default value for reference types is null reference. Assignment to a variable of a reference type creates a copy of the reference rather than a copy of the referenced value. Value types are created on the stack. The lifetime is determined by the lifetime of the variable. Assignment to a variable of a value type creates a copy of the value being assigned. Value types have different default values. For example, boolean default value is False, decimal 0, string an empty string “”.
Boolean values
There is a duality built in our world. There is a Heaven and Earth, water and fire, jing and jang, man and woman, love and hatred. In Visual Basic the Boolean data type is a primitive data type having one of two values: True or False. This is a fundamental data type. Very common in computer programs.
Integers
Integers are a subset of the real numbers. They are written without a fraction or a decimal component. Integers fall within a set Z = {…, -2, -1, 0, 1, 2, …} Integers are infinite.
In computer languages, integers are primitive data types. Computers can practically work only with a subset of integer values, because computers have finite capacity. Integers are used to count discrete entities.
Floating point numbers
Floating point numbers represent real numbers in computing. Real numbers measure continuous quantities, like weight, height, or speed. In Visual Basic we have three important floating point types: Single, Double, and Decimal
Enumerations
Enumerated type (also called enumeration or enum) is a data type consisting of a set of named values. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. Enumerations make the code more readable.
Strings and chars
String is a data type representing textual data in computer programs. A string in Visual Basic is a sequence of Unicode characters. A Char is a single Unicode character. Strings are enclosed by single or double quotes.
Date
A Date is value type, which contain date values, time values, or date and time values.