Skip to content

Commit 2ec0587

Browse files
pkulikovBillWagner
authored andcommitted
Added overview of C# member access operators (#12240)
* Added overview of C# member access operators * Updated TOC * Use indexer operator * Minor edits * Setup redirection * Minor edits * Addressed feedback
1 parent 075a08a commit 2ec0587

19 files changed

+215
-212
lines changed

.openpublishing.redirection.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@
482482
"source_path":"docs/csharp/language-reference/operators/increment-operator.md",
483483
"redirect_url":"/dotnet/csharp/language-reference/operators/arithmetic-operators#increment-operator-"
484484
},
485+
{
486+
"source_path": "docs/csharp/language-reference/operators/index-operator.md",
487+
"redirect_url": "/dotnet/csharp/language-reference/operators/member-access-operators#indexer-operator-"
488+
},
485489
{
486490
"source_path":"docs/csharp/language-reference/operators/left-shift-assignment-operator.md",
487491
"redirect_url":"/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#compound-assignment"
@@ -502,6 +506,10 @@
502506
"source_path":"docs/csharp/language-reference/operators/logical-negation-operator.md",
503507
"redirect_url":"/dotnet/csharp/language-reference/operators/boolean-logical-operators#logical-negation-operator-"
504508
},
509+
{
510+
"source_path": "docs/csharp/language-reference/operators/member-access-operator.md",
511+
"redirect_url": "/dotnet/csharp/language-reference/operators/member-access-operators#member-access-operator-"
512+
},
505513
{
506514
"source_path": "docs/csharp/language-reference/operators/modulus-assignment-operator.md",
507515
"redirect_url": "/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment"
@@ -518,6 +526,10 @@
518526
"source_path": "docs/csharp/language-reference/operators/null-conditional-operator.md",
519527
"redirect_url": "/dotnet/csharp/language-reference/operators/null-coalescing-operator"
520528
},
529+
{
530+
"source_path": "docs/csharp/language-reference/operators/null-conditional-operators.md",
531+
"redirect_url": "/dotnet/csharp/language-reference/operators/member-access-operators#null-conditional-operators--and-"
532+
},
521533
{
522534
"source_path":"docs/csharp/language-reference/operators/or-assignment-operator.md",
523535
"redirect_url":"/dotnet/csharp/language-reference/operators/boolean-logical-operators#compound-assignment"

docs/csharp/language-reference/compiler-messages/cs0201.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ ms.assetid: cf5d6701-50cc-4e4f-878b-e1a4ad8a2061
1111

1212
Only assignment, call, increment, decrement, and new object expressions can be used as a statement
1313

14-
The compiler generates an error when it encounters an invalid statement. An invalid statement is any line or series of lines ending in a semicolon that does not represent an assignment ([=](../operators/assignment-operator.md)), method call [()](../operators/invocation-operator.md), [new](../keywords/new.md), [--](../operators/arithmetic-operators.md#decrement-operator---) or [++](../operators/arithmetic-operators.md#increment-operator-) operation. For more information, see [Statements, Expressions, and Operators](../../programming-guide/statements-expressions-operators/index.md).
14+
The compiler generates an error when it encounters an invalid statement. An invalid statement is any line or series of lines ending in a semicolon that does not represent an assignment ([=](../operators/assignment-operator.md)), method call [()](../operators/member-access-operators.md#invocation-operator-), [new](../keywords/new.md), [--](../operators/arithmetic-operators.md#decrement-operator---) or [++](../operators/arithmetic-operators.md#increment-operator-) operation. For more information, see [Statements, Expressions, and Operators](../../programming-guide/statements-expressions-operators/index.md).
1515

1616
## Example
1717

18-
The following sample generates CS0201 because 2 * 3 is an expression, not a statement. To make the code compile, try assigning the value of the expression to a variable.
18+
The following sample generates CS0201 because 2 * 3 is an expression, not a statement. To make the code compile, try assigning the value of the expression to a variable.
1919

2020
```csharp
2121
// CS0201.cs

docs/csharp/language-reference/keywords/extern-alias.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: "extern alias - C# Reference"
33
ms.custom: seodec18
4-
54
ms.date: 07/20/2015
65
f1_keywords:
76
- "alias_CSharpKeyword"
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
22
title: "Namespace Keywords - C# Reference"
33
ms.custom: seodec18
4-
54
ms.date: 07/20/2015
65
helpviewer_keywords:
76
- "namespaces [C#], keywords"
87
ms.assetid: 091a66eb-b10d-4f54-9102-5ac0d4bdb84b
98
---
109
# Namespace Keywords (C# Reference)
10+
1111
This section describes the keywords and operators that are associated with using namespaces:
1212

13-
- [namespace](../../../csharp/language-reference/keywords/namespace.md)
14-
- [using](../../../csharp/language-reference/keywords/using.md)
13+
- [namespace](namespace.md)
14+
- [using](using-directive.md)
1515
- [using static](using-static.md)
16-
- [. Operator](../../../csharp/language-reference/operators/member-access-operator.md)
17-
- [:: Operator](../../../csharp/language-reference/operators/namespace-alias-qualifer.md)
18-
- [extern alias](../../../csharp/language-reference/keywords/extern-alias.md)
16+
- [. Operator](../operators/member-access-operators.md#member-access-operator-)
17+
- [:: Operator](../operators/namespace-alias-qualifer.md)
18+
- [extern alias](extern-alias.md)
1919

2020
## See also
2121

22-
- [C# Reference](../../../csharp/language-reference/index.md)
23-
- [C# Programming Guide](../../../csharp/programming-guide/index.md)
24-
- [C# Keywords](../../../csharp/language-reference/keywords/index.md)
25-
- [Namespaces](../../../csharp/programming-guide/namespaces/index.md)
22+
- [C# Reference](../index.md)
23+
- [C# Programming Guide](../../programming-guide/index.md)
24+
- [C# Keywords](index.md)
25+
- [Namespaces](../../programming-guide/namespaces/index.md)

docs/csharp/language-reference/keywords/using.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ ms.assetid: 124e1a63-2a4b-4132-b269-3b6d8d3ef72d
1212
# using (C# Reference)
1313

1414
The `using` keyword has three major uses:
15-
- The [using statement](using-statement.md) defines a scope at the end of which an object will be disposed.
16-
- The using [directive](using-directive.md) creates an alias for a namespace or imports types defined in other namespaces.
15+
16+
- The [using statement](using-statement.md) defines a scope at the end of which an object will be disposed.
17+
- The [using directive](using-directive.md) creates an alias for a namespace or imports types defined in other namespaces.
1718
- The [using static directive](using-static.md) imports the members of a single class.
1819

1920
## See also

docs/csharp/language-reference/operators/conditional-operator.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: "?: Operator - C# Reference"
33
ms.custom: seodec18
4-
54
ms.date: "11/20/2018"
65
f1_keywords:
76
- "?:_CSharpKeyword"
@@ -38,9 +37,9 @@ is evaluated as
3837
a ? b : (c ? d : e)
3938
```
4039

41-
A handy mnemonic device you can use to remember how this operator evaluates is by asking:
40+
A mnemonic device you can use to remember how this operator evaluates is to ask:
4241

43-
```
42+
```text
4443
is this condition true ? yes : no
4544
```
4645

@@ -90,6 +89,6 @@ For more information, see the [Conditional operator](~/_csharplang/spec/expressi
9089
- [C# Programming Guide](../../programming-guide/index.md)
9190
- [C# Operators](index.md)
9291
- [if-else statement](../keywords/if-else.md)
93-
- [?. and ?[] Operators](null-conditional-operators.md)
92+
- [?. and ?[] Operators](member-access-operators.md#null-conditional-operators--and-)
9493
- [?? Operator](null-coalescing-operator.md)
9594
- [ref keyword](../keywords/ref.md)

docs/csharp/language-reference/operators/index-operator.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

docs/csharp/language-reference/operators/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ The following sections list the C# operators starting with the highest precedenc
3131

3232
These are the highest precedence operators.
3333

34-
[x.y](member-access-operator.md) – member access.
34+
[x.y](member-access-operators.md#member-access-operator-) – member access.
3535

36-
[x?.y](null-conditional-operators.md) – null conditional member access. Returns `null` if the left-hand operand evaluates to `null`.
36+
[x?.y](member-access-operators.md#null-conditional-operators--and-) – null conditional member access. Returns `null` if the left-hand operand evaluates to `null`.
3737

38-
[x?[y]](null-conditional-operators.md) - null conditional index access. Returns `null` if the left-hand operand evaluates to `null`.
38+
[x?[y]](member-access-operators.md#null-conditional-operators--and-) - null conditional array element or type indexer access. Returns `null` if the left-hand operand evaluates to `null`.
3939

40-
[f(x)](invocation-operator.md)function invocation.
40+
[f(x)](member-access-operators.md#invocation-operator-)method call or delegate invocation.
4141

42-
[a[x]](index-operator.md)aggregate object indexing.
42+
[a[x]](member-access-operators.md#indexer-operator-)array element or type indexer access.
4343

4444
[x++](arithmetic-operators.md#increment-operator-) – postfix increment. Returns the value of x and then updates the storage location with the value of x that is one greater (typically adds the integer 1).
4545

docs/csharp/language-reference/operators/member-access-operator.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)