value type
A type whose variables hold the data itself, so assigning one to another copies the whole value.
In more detail
Numbers, bool, char, DateTime, enums and structs are value types. A method that receives one gets its own copy and cannot change the caller's.
Related terms
- reference type — A type whose variables hold a reference, a pointer to an object stored elsewhere, rather than the value itself.
- struct — A C# value type declared with the struct keyword, copied in full whenever it is assigned or passed.
- boxing — Wrapping a value type such as an int in an object on the heap so it can be treated as an object.
Taught in
- The C# Language: Types, Variables, and Flow Control — Modern .NET Core, C# & Enterprise Microservices
- Collections, Generics, and LINQ — Modern .NET Core, C# & Enterprise Microservices