Types
Value Types and Reference Types
Value Types / Primitive Types
A variable of a value type directly contains their data.
With value types, each variable has its own copy of the data, and it's not possible for operations on one variable to affect the other.
bool
, byte
, sbyte
, char
, decimal
, double
, float
, int
, uint
, nint
, nuint
, long
, ulong
, short
, ushort
, struct
, enum
, tuple
Reference Types / Non-Primitive Types
A variable of a reference type contains a reference to their data (objects).
With reference types, two variables can reference the same object; therefore, operations on one variable can affect the object referenced by the other variable.
class
, interface
, delegate
, record
, object
, string
, dynamic
Last updated