Value type
A value type is a type whose values are treated as independent data when assigned or passed, rather than as references to a shared object.
.NET in Action, Second Edition
A value type is a .NET type whose values contain their data directly.
- How it is used
- Explains how .NET classifies types and why value/reference behavior matters when values cross method and API boundaries.
- How deep it goes
- Defines direct data storage, contrasts references, and introduces boxing without detailing copying or parameter-passing semantics.
- Examples
- Uses an int passed to Console.WriteLine and an integer Book.Id property to illustrate boxing and nullability.
- What you can do after
- Evaluate whether a .NET type is a value type and recognize when C# boxes it for an object parameter.
Read how .NET in Action, Second Edition explains value type →
F# in Action: A Revised Edition of Get Programming with F#
A value type is a type whose variables directly contain their data and whose values are copied when assigned or passed by value.
- How it is used
- Uses value types to model tuples or records with pass-by-value semantics when performance requirements warrant them.
- How deep it goes
- Explains storage, passing, copying, and garbage-collection tradeoffs, but defers detailed performance measurement to testing.
- Examples
- Uses struct tuple syntax and [<Struct>] record syntax as concrete examples.
- What you can do after
- Apply F# struct syntax to create value tuples or value-type records, then benchmark the resulting representation.
Read how F# in Action: A Revised Edition of Get Programming with F# explains value type →
High Performance Unity Game Development
A data type whose values are copied directly when passed or assigned, rather than passing a reference to the same object.
- How it is used
- Guides data-structure choices for storing and passing game data with performance in mind.
- How deep it goes
- Explains copying semantics and performance caveats, treating 16 bytes as a guideline rather than a hard limit.
- Examples
- Uses Vector2 position data and an EnemyData class containing arrays to contrast representation choices.
- What you can do after
- Evaluate whether temporary, tightly coupled primitive data fits a small struct, and use ref when avoiding a copy is warranted.
Read how High Performance Unity Game Development explains value type →
Also covered in
What to know first
- inheritanceInheritance is a mechanism in which a derived type or descendant element receives properties or behavior from a parent, subject to rules that may allow specialization or overriding.
- primitive typeA primitive type is a predefined basic data type representing a simple value rather than a composite structure of multiple values or fields.
- classA class is a programming-language construct that defines a type’s structure and behavior and provides a basis for creating or representing objects.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
Related concepts
- structincludes · A struct is a named composite type or data structure that groups multiple fields or values into one structured unit.
- reference typecontrasts with · A reference type is a type whose values provide indirect access to data or objects stored separately from those values.
- primitive typeincludes · A primitive type is a predefined basic data type representing a simple value rather than a composite structure of multiple values or fields.
- zero valueconfigured by · A zero value is the default, type-dependent value assigned when a variable, field, or newly allocated value has no explicit initial value.
Questions about value type
What is value type?
A value type is a type whose values are treated as independent data when assigned or passed, rather than as references to a shared object.
Which Manning books explain value type?
.NET in Action, Second Edition, F# in Action: A Revised Edition of Get Programming with F# and High Performance Unity Game Development.
What should I know before learning value type?
Manning books that teach value type usually introduce inheritance, primitive type, class and array first.
What is the difference between value type and reference type?
A value type is a type whose values are treated as independent data when assigned or passed, rather than as references to a shared object. A reference type is a type whose values provide indirect access to data or objects stored separately from those values.
What kinds of value type are there?
Kinds of value type include struct, ValueTask and primitive type.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


