O'Reilly logo

Start Here!™ Fundamentals of Microsoft® .NET Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Value and Reference Types

A value type is a data type where a variable stores the actual value of the data. For example, an Integer uses 4 bytes to hold the value of a number. When you define a variable of type Integer, the variable’s memory location holds the value.

In contrast, a reference type is a data type where a variable holds a reference pointing to some other location in memory that holds the actual data. String is a reference type because a String variable doesn’t actually hold the characters in the string. Instead, it holds a reference to a position in memory that holds the characters.

Classes are also reference types. That means a variable with a class type actually holds only a reference to a piece of memory that holds the object’s ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required