# Value Types and Reference TypesValue Types and Reference Types

Visual Basic 中有两种类型：引用类型和值类型。There are two kinds of types in Visual Basic: reference types and value types. 引用类型的变量存储对其数据（对象）的引用，而值类型的变量直接包含其数据。Variables of reference types store references to their data (objects), while variables of value types directly contain their data. 对于引用类型，两种变量可引用同一对象；因此，对一个变量执行的操作会影响另一个变量所引用的对象。With reference types, two variables can reference the same object; therefore, operations on one variable can affect the object referenced by the other variable. 对于值类型，每个变量都有自己的数据副本，对一个变量执行的操作不可能影响另一个变量（在参数上传递修饰符的情况除外）。With value types, each variable has its own copy of the data, and it is not possible for operations on one variable to affect the other (except in the case of the ByRef modifier on parameters).

## 值类型Value Types

• 所有数值数据类型All numeric data types

• BooleanCharDateBoolean, Char, and Date

• 所有结构（即使它们的成员是引用类型）All structures, even if their members are reference types

• 枚举，因为它们的基础类型始终为、、、 SByte Short Integer LongByte 、、 UShort UIntegerULongEnumerations, since their underlying type is always SByte, Short, Integer, Long, Byte, UShort, UInteger, or ULong

## 引用类型Reference Types

• String

• 所有数组（即使它们的元素为值类型）All arrays, even if their elements are value types

• 类类型，如FormClass types, such as Form

• 委托Delegates

Dim totals() As Single = New Single(8) {}


## 不是类型的元素Elements That Are Not Types

• 命名空间Namespaces

• 模块Modules

• 事件Events

• 属性和过程Properties and procedures

• 变量、常量和字段Variables, constants, and fields