|
1 | 1 | ---
|
2 | 2 | title: "Member access and null-conditional operators and expressions:"
|
3 | 3 | description: "C# operators that you use to access type members or null-conditionally access type members. These operators include the dot operator - `.`, indexers - `[`, `]`, `^` and `..`, and invocation - `(`, `)`."
|
4 |
| -ms.date: 04/04/2025 |
| 4 | +ms.date: 05/29/2025 |
5 | 5 | author: pkulikov
|
6 | 6 | f1_keywords:
|
7 | 7 | - "._CSharpKeyword"
|
@@ -35,7 +35,7 @@ helpviewer_keywords:
|
35 | 35 | ---
|
36 | 36 | # Member access operators and expressions - the dot, indexer, and invocation operators.
|
37 | 37 |
|
38 |
| -You use several operators and expressions to access a type member. Member access operators include member access (`.`), array element, or indexer access (`[]`), index-from-end (`^`), range (`..`), null-conditional operators (`?.` and `?[]`), and method invocation (`()`). These include the *null-conditional* member access (`?.`), and indexer access (`?[]`) operators. |
| 38 | +You use several operators and expressions to access a type member. Member access operators include member access (`.`), array element, or indexer access (`[]`), index-from-end (`^`), range (`..`), null-conditional operators (`?.` and `?[]`), and method invocation (`()`). These operators include the *null-conditional* member access (`?.`), and indexer access (`?[]`) operators. |
39 | 39 |
|
40 | 40 | - [`.` (member access)](#member-access-expression-): to access a member of a namespace or a type
|
41 | 41 | - [`[]` (array element or indexer access)](#indexer-operator-): to access an array element or a type indexer
|
@@ -205,6 +205,9 @@ You also use parentheses to adjust the order in which to evaluate operations in
|
205 | 205 |
|
206 | 206 | Index and range operators can be used with a type that is *countable*. A *countable* type is a type that has an `int` property named either `Count` or `Length` with an accessible `get` accessor. [Collection expressions](./collection-expressions.md) also rely on *countable* types.
|
207 | 207 |
|
| 208 | +> [!NOTE] |
| 209 | +> Single dimensional arrays are *countable*. Multi-dimensional arrays aren't. The `^` and `..` (range) operators can't be used in multi-dimensional arrays. |
| 210 | +
|
208 | 211 | The `^` operator indicates the element position from the end of a sequence. For a sequence of length `length`, `^n` points to the element with offset `length - n` from the start of a sequence. For example, `^1` points to the last element of a sequence and `^length` points to the first element of a sequence.
|
209 | 212 |
|
210 | 213 | :::code language="csharp" source="snippets/shared/MemberAccessOperators.cs" id="IndexFromEnd":::
|
|
0 commit comments