Skip to content

Commit 1529a5b

Browse files
committed
respond to feedback
1 parent d548025 commit 1529a5b

File tree

2 files changed

+46
-24
lines changed

2 files changed

+46
-24
lines changed

docs/csharp/whats-new/csharp-7-3.md

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,68 +45,90 @@ unsafe struct S
4545
}
4646
```
4747

48-
In earlier versions of C#, you needed to pin a variable to access one of the integers that are part of `myFixedField`. Now, the following code compiles:
48+
In earlier versions of C#, you needed to pin a variable to access one of the integers that are part of `myFixedField`. Now, the following code compiles in a safe context:
4949

5050
```csharp
51-
var s = new S();
52-
int p = s.myFixedField[5];
51+
class C
52+
{
53+
static S s = new S();
54+
55+
public void M()
56+
{
57+
int p = s.myFixedField[5];
58+
}
59+
}
5360
```
5461

55-
The variable `p` doesn't need to be pinned. Note that you still need an `unsafe` context.
62+
The variable `p` doesn't need to be pinned. Note that you still need an `unsafe` context. In earlier versions of C#, you need to declare a second fixed pointer:
5663

57-
You can learn more in the article on the [`fixed` statement](../language-reference/keywords/fixed-statement.md).
64+
```csharp
65+
class C
66+
{
67+
static S s = new S();
68+
69+
public void M()
70+
{
71+
fixed (int* ptr = s.myFixedField)
72+
{
73+
int p = ptr[5];
74+
}
75+
}
76+
}
77+
```
78+
79+
Fore more information, see the article on the [`fixed` statement](../language-reference/keywords/fixed-statement.md).
5880

5981
### `ref` local variables may be reassigned
6082

61-
Now, `ref` locals may be reassigned to refer to different storage after being initialized. The following code now compiles:
83+
Now, `ref` locals may be reassigned to refer to different instances after being initialized. The following code now compiles:
6284

63-
```csharp
85+
```csharp
6486
ref VeryLargeStruct reflocal = ref veryLargeStruct; // initialization
6587
refLocal = ref anotherVeryLargeStruct; // reassigned, refLocal refers to different storage.
6688
```
6789

68-
You can learn more in the article on [`ref` returns and `ref` locals](../programming-guide/classes-and-structs/ref-returns.md).
90+
For more information, see the article on [`ref` returns and `ref` locals](../programming-guide/classes-and-structs/ref-returns.md).
6991

7092
### `stackalloc` arrays support initializers
7193

72-
You have been able to specify the values for elements in an array when you initialize the array:
94+
You've been able to specify the values for elements in an array when you initialize it:
7395

7496
```csharp
7597
var arr = new int[3] {1, 2, 3};
76-
var arr2 = new int[] { 1, 2, 3};
98+
var arr2 = new int[] {1, 2, 3};
7799
```
78100

79101
Now, that same syntax can be applied to arrays that are declared with `stackalloc`:
80102

81103
```csharp
82104
int* pArr = stackalloc int[3] {1, 2, 3};
83-
int* pArr2 = stackalloc int[] { 1, 2, 3};
105+
int* pArr2 = stackalloc int[] {1, 2, 3};
84106
Span<int> arr = stackalloc [] {1, 2, 3};
85107
```
86108

87-
You can learn more in the article on the [`stackalloc` statement](../language-reference/keywords/stackalloc.md).
109+
For more information, see the [`stackalloc` statement](../language-reference/keywords/stackalloc.md) article in the language reference.
88110

89111
### More types support the `fixed` statement
90112

91113
The `fixed` statement supported a limited set of types. Starting with C# 7.3, any type that contains a `DangerousGetPinnableReference()` method that returns a `ref T` or `ref readonly T` may be `fixed`. Adding this feature means that `fixed` can be used with <xref:System.Span%601?displayProperty=nameWithType> and related types.
92114

93-
You can learn more in the article on the [`fixed` statement](../language-reference/keywords/fixed-statement.md).
115+
For more information, see the [`fixed` statement](../language-reference/keywords/fixed-statement.md) article in the language reference.
94116

95117
### Enhanced generic constraints
96118

97119
You can now specify the type <xref:System.Enum?displayProperty=nameWithType> or <xref:System.Delegate?displayProperty=nameWithType> as base class constraints for a type parameter.
98120

99-
You can also use the new `unmanaged` constraint, to specify that a type parameter must be an **unmanaged type**. An **unmanaged type** is a type that isn't a reference type, and doesn't contain any reference type at any level of nesting.
121+
You can also use the new `unmanaged` constraint, to specify that a type parameter must be an **unmanaged type**. An **unmanaged type** is a type that isn't a reference type and doesn't contain any reference type at any level of nesting.
100122

101-
You can learn more in the articles on [`where` generic constraints](../language-reference/keywords/where-generic-type-constraints.md) and the article covering [constraints on type parameters](../programming-guide/generics/constraints-on-type-parameters.md).
123+
For more information, see the articles on [`where` generic constraints](../language-reference/keywords/where-generic-type-constraint.md) and [constraints on type parameters](../programming-guide/generics/constraints-on-type-parameters.md).
102124

103125
## Make existing features better
104126

105127
The second theme provides improvements to features in the language. These features improve productivity when writing C#.
106128

107129
### Tuples support `==` and `!=`
108130

109-
The C# tuple types now support `==` and `!=`. You can learn more about the rules in the article on [tuples](../tuples.md#equality-and-tuples).
131+
The C# tuple types now support `==` and `!=`. Fore more information, see the section covering [equality](../tuples.md#equality-and-tuples) in the article on [tuples](../tuples.md#equality-and-tuples).
110132

111133
### Attach attributes to the backing fields for auto-implemented properties
112134

@@ -117,7 +139,7 @@ This syntax is now supported:
117139
public int SomeProperty { get; set; }
118140
```
119141

120-
The attribute `SomeThingAboutFieldAttribute` is applied to the compiler generated backing field for `SomeProperty`. You can learn more in the articles on [attributes in C#](../programming-guide/concepts/attributes/index.md).
142+
The attribute `SomeThingAboutFieldAttribute` is applied to the compiler generated backing field for `SomeProperty`. For more information, see [attributes](../programming-guide/concepts/attributes/index.md) in the C# programming guide.
121143

122144
### `in` method overload resolution tiebreaker
123145

@@ -128,7 +150,7 @@ static void M(S arg);
128150
static void M(in S arg);
129151
```
130152

131-
Now, the by value (first in the preceding example) overload is better than the by readonly reference version. To specify the by readonly reference version is called, you must include the `in` modifier when calling the method.
153+
Now, the by value (first in the preceding example) overload is better than the by readonly reference version. To call the version with the readonly reference argument, you must include the `in` modifier when calling the method.
132154

133155
> [!NOTE]
134156
> This was implemented as a bug fix. This no longer is ambiguous even with the language version set to "7.2".
@@ -137,7 +159,7 @@ For more information, see the article on the [`in` parameter modifier](../langua
137159

138160
### Extend expression variables in initializers
139161

140-
The syntax added in C# 7.0 to permit out variable declarations has been extended to include field initializers, property initializers, constructor initializers, and query clauses. It enables code such as the following example:
162+
The syntax added in C# 7.0 to aloow `out` variable declarations has been extended to include field initializers, property initializers, constructor initializers, and query clauses. It enables code such as the following example:
141163

142164
```csharp
143165
public class B
@@ -169,16 +191,16 @@ You'll only notice this change because you'll find fewer compiler errors for amb
169191

170192
## New compiler options
171193

172-
New compiler options support new build and DevOps scenarios for C# programs
194+
New compiler options support new build and DevOps scenarios for C# programs.
173195

174-
### Public or OSS signing
196+
### Public or Open Source signing
175197

176198
The `-publicsign` compiler option instructs the compiler to sign the assembly using a public key. The assembly is marked as signed, but the signature is taken from the public key. This option enables you to build signed assemblies from open-source projects using a public key.
177199

178200
For more information, see the [-publicsign compiler option](../language-reference/compiler-options/publicsign-compiler-option.md) article.
179201

180202
### pathmap
181203

182-
The `-pathmap` compiler option instructs the compiler to replace source paths from the build environment with mapped source paths. The pathmap option controls the source path written by the compiler to PDB files or for the <xref:System.Runtime.CompilerServices.CallerFilePathAttribute>.
204+
The `-pathmap` compiler option instructs the compiler to replace source paths from the build environment with mapped source paths. The `pathmap` option controls the source path written by the compiler to PDB files or for the <xref:System.Runtime.CompilerServices.CallerFilePathAttribute>.
183205

184206
For more information, see the [-pathmap compiler option](../language-reference/compiler-options/pathmap-compile-option.md) article.

docs/csharp/whats-new/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ the C# language. The following links provide detailed information on the
1212
major features added in each release.
1313

1414
> [!IMPORTANT]
15-
> The C# language relies on types and methods in a *standard library* for some of the features. One example is exception processing. Every `throw` statement or expression is checked to ensure the object being thrown is derived from <xref:System.Exception>. Similarly, every `catch` is checked to ensure that the type being caught is derived from <xref:System.Exception>. Each version may add new requirements. To use the latest language features in older environments, you may need to install specific libraries. These dependencies are documented in the page for each specific version. You can learn more about the [relationships between language and library](relationships-between-language-and-library.md) for background on this dependency.
15+
> The C# language relies on types and methods in a *standard library* for some of the features. One example is exception processing. Every `throw` statement or expression is checked to ensure the object being thrown is derived from <xref:System.Exception>. Similarly, every `catch` is checked to ensure that the type being caught is derived from <xref:System.Exception>. Each version may add new requirements. To use the latest language features in older environments, you may need to install specific libraries. These dependencies are documented in the page for each specific version. For more information, see the article on the [relationships between language and library](relationships-between-language-and-library.md) for background on this dependency.
1616
1717
* [C# 7.3](csharp-7-3.md):
18-
- This page describes the latest features in the C# language. C# 7.3 is currently available in [Visual Studio 2017 version 15.7](https://www.visualstudio.com/vs/whatsnew/), and in the [.NET Core 2.1 SDK Preview](../../core/whats-new/index.md).
18+
- This page describes the latest features in the C# language. C# 7.3 is currently available in [Visual Studio 2017 version 15.7](https://www.visualstudio.com/vs/whatsnew/), and in the [.NET Core 2.1 SDK 2.1.300 RC1](../../core/whats-new/index.md).
1919
* [C# 7.2](csharp-7-2.md):
2020
- This page describes the features added in the C# language. C# 7.2 is currently available in [Visual Studio 2017 version 15.5](https://www.visualstudio.com/vs/whatsnew/), and in the [.NET Core 2.0 SDK](../../core/whats-new/index.md).
2121
* [C# 7.1](csharp-7-1.md):

0 commit comments

Comments
 (0)