Skip to content
Merged
Show file tree
Hide file tree
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

This file was deleted.

62 changes: 34 additions & 28 deletions docs/csharp/language-reference/operators/dereference-operator.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "-> Operator (C# Reference)"
ms.date: 07/20/2015
ms.date: 11/26/2018
f1_keywords:
- "->_CSharpKeyword"
helpviewer_keywords:
Expand All @@ -9,30 +9,36 @@ helpviewer_keywords:
ms.assetid: e39ccdc1-f1ff-4a92-bf1d-ac2c8c11316a
---
# -> Operator (C# Reference)
The `->` operator combines pointer dereferencing and member access.

## Remarks
An expression of the form,

```csharp
x->y
```

(where `x` is a pointer of type `T*` and `y` is a member of `T`) is equivalent to,

```csharp
(*x).y
```

The `->` operator can be used only in code that is marked as [unsafe](../../../csharp/language-reference/keywords/unsafe.md).

The `->` operator cannot be overloaded.

## Example
[!code-csharp[csRefOperators#15](../../../csharp/language-reference/operators/codesnippet/CSharp/dereference-operator_1.cs)]

## See Also

- [C# Reference](../../../csharp/language-reference/index.md)
- [C# Programming Guide](../../../csharp/programming-guide/index.md)
- [C# Operators](../../../csharp/language-reference/operators/index.md)

The pointer member access operator `->` combines pointer indirection and member access.

If `x` is a pointer of the type `T*` and `y` is an accessible member of `T`, an expression of the form

```csharp
x->y
```

is equivalent to

```csharp
(*x).y
```

The `->` operator requires [unsafe](../keywords/unsafe.md) context.

For more information, see [How to: access a member with a pointer](../../programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md).

## Operator overloadability

The `->` operator cannot be overloaded.

## C# language specification

For more information, see the [Pointer member access](~/_csharplang/spec/unsafe-code.md#pointer-member-access) section of the [C# language specification](../language-specification/index.md).

## See also

- [C# Reference](../index.md)
- [C# Programming Guide](../../programming-guide/index.md)
- [C# Operators](index.md)
- [Pointer types](../../programming-guide/unsafe-code-pointers/pointer-types.md)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: "How to: Access a Member with a Pointer (C# Programming Guide)"
title: "How to: access a member with a pointer (C# Programming Guide)"
ms.date: 07/20/2015
helpviewer_keywords:
- "pointers [C#], member access"
ms.assetid: 1e998498-8c85-4a78-8ce2-4d8c20f08342
---
# How to: Access a Member with a Pointer (C# Programming Guide)
# How to: access a member with a pointer (C# Programming Guide)
To access a member of a struct that is declared in an unsafe context, you can use the member access operator as shown in the following example in which `p` is a pointer to a [struct](../../../csharp/language-reference/keywords/struct.md) that contains a member `x`.

```
Expand Down