Skip to content

Reference types #31962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions docs/csharp/language-reference/keywords/reference-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,26 @@ helpviewer_keywords:
- "types [C#], reference types"
ms.assetid: 801cf030-6e2d-4a0d-9daf-1431b0c31f47
---
# Reference types (C# Reference)
# Reference types (C# reference)

There are two kinds of types in C#: 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 in, ref and out parameter variables; see [in](in-parameter-modifier.md), [ref](ref.md) and [out](out-parameter-modifier.md) parameter modifier).
There are two kinds of types in C#: 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's not possible for operations on one variable to affect the other (except in the case of `in`, `ref`, and `out` parameter variables; see [in](in-parameter-modifier.md), [ref](ref.md), and [out](out-parameter-modifier.md) parameter modifier).

The following keywords are used to declare reference types:

- [class](class.md)

- [interface](interface.md)

- [delegate](../builtin-types/reference-types.md)
- [record](../builtin-types/record.md)

C# also provides the following built-in reference types:

- [dynamic](../builtin-types/reference-types.md)

- [object](../builtin-types/reference-types.md)

- [string](../builtin-types/reference-types.md)

## See also

- [C# Reference](../index.md)
- [C# Keywords](index.md)
- [C# reference](../index.md)
- [C# keywords](index.md)
- [Pointer types](../unsafe-code.md#pointer-types)
- [Value types](../builtin-types/value-types.md)