You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fundamentals/code-analysis/overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ If rule violations are found by an analyzer, they're reported as a suggestion, w
25
25
*Code quality analysis* ("CAxxxx") rules inspect your C# or Visual Basic code for security, performance, design and other issues. Analysis is enabled, by default, for projects that target .NET 5 or later. You can enable code analysis on projects that target earlier .NET versions by setting the [EnableNETAnalyzers](../../core/project-sdk/msbuild-props.md#enablenetanalyzers) property to `true`. You can also disable code analysis for your project by setting `EnableNETAnalyzers` to `false`.
26
26
27
27
> [!TIP]
28
-
> If you're using Visual Studio, many analyzer rules have associated *code fixes* that you can apply to correct the problem. Code fixes are shown in the light bulb icon menu.
28
+
> If you're using Visual Studio, many analyzer rules have associated *code fixes* that you can apply to automatically correct the problem. Code fixes are shown in the light bulb icon menu.
Copy file name to clipboardExpand all lines: docs/fundamentals/code-analysis/quality-rules/ca1870.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Using a cached <xref:System.Buffers.SearchValues%601> instance is more efficient
37
37
38
38
Create and cache a <xref:System.Buffers.SearchValues%601> instance in a `static readonly` field, then pass that instance to the `IndexOfAny` or `ContainsAny` call instead.
39
39
40
-
A code fixer that performs this transformation is available.
40
+
A *code fix* that automatically performs this transformation is available.
Copy file name to clipboardExpand all lines: docs/fundamentals/code-analysis/style-rules/ide0028.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,10 +28,10 @@ dev_langs:
28
28
29
29
This style rule concerns the use of [collection initializers](../../../csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md) and, if you're using C# 12 or later, [collection expressions](../../../csharp/language-reference/operators/collection-expressions.md) for collection initialization.
30
30
31
-
In .NET 8 (C# 12) and later versions, if you have the `dotnet_style_prefer_collection_expression` option set to `true`, the code fixer in Visual Studio converts your collection initialization code to use a collection expression (`List<int> list = [1, 2, 3];`). In Visual Basic and in .NET 7 (C# 11) and earlier versions, the code fixer converts your code to use a collection initializer (`List<int> list = new List<int> { 1, 2, 3 };`).
31
+
In .NET 8 (C# 12) and later versions, if you have the `dotnet_style_prefer_collection_expression` option set to `true`, the *code fix* in Visual Studio converts your collection initialization code to use a collection expression (`List<int> list = [1, 2, 3];`). In Visual Basic and in .NET 7 (C# 11) and earlier versions, the *code fix* converts your code to use a collection initializer (`List<int> list = new List<int> { 1, 2, 3 };`).
32
32
33
33
> [!NOTE]
34
-
> If you use the code fixer in Visual Studio, the change it offers might have different semantics in some cases. For example, `int[] x = new int[] { }` is replaced with `int[] x = [];`, which has slightly different semantics—the compiler uses a singleton for `x` instead of creating a new instance.
34
+
> If you use the *code fix* in Visual Studio, the change it offers might have different semantics in some cases. For example, `int[] x = new int[] { }` is replaced with `int[] x = [];`, which has slightly different semantics—the compiler uses a singleton for `x` instead of creating a new instance.
0 commit comments