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/extensibility/roslyn-analyzers-and-code-aware-library-for-immutablearrays.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,18 +29,18 @@ Users are familiar with writing code like the following:
29
29
30
30
```csharp
31
31
vara1=newint[0];
32
-
Console.WriteLine("a1.Length = {0}", a1.Length);
32
+
Console.WriteLine("a1.Length = {0}", a1.Length);
33
33
vara2=newint[] { 1, 2, 3, 4, 5 };
34
-
Console.WriteLine("a2.Length = {0}", a2.Length);
34
+
Console.WriteLine("a2.Length = {0}", a2.Length);
35
35
```
36
36
37
37
Creating empty arrays to fill in with subsequent lines of code and using collection initializer syntax are familiar to C# developers. However, writing the same code for an ImmutableArray crashes at run time:
38
38
39
39
```csharp
40
40
varb1=newImmutableArray<int>();
41
-
Console.WriteLine("b1.Length = {0}", b1.Length);
41
+
Console.WriteLine("b1.Length = {0}", b1.Length);
42
42
varb2=newImmutableArray<int> { 1, 2, 3, 4, 5 };
43
-
Console.WriteLine("b2.Length = {0}", b2.Length);
43
+
Console.WriteLine("b2.Length = {0}", b2.Length);
44
44
```
45
45
46
46
The first error is due to ImmutableArray implementation's using a struct to wrap the underlying data storage. Structs must have parameter-less constructors so that `default(T)` expressions can return structs with all zero or null members. When the code accesses `b1.Length`, there is a run time null dereference error because there is no underlying storage array in the ImmutableArray struct. The correct way to create an empty ImmutableArray is `ImmutableArray<int>.Empty`.
@@ -61,7 +61,7 @@ The template opens a *DiagnosticAnalyzer.cs* file. Choose that editor buffer tab
Roslyn brings together diagnostics and fixes by matching these identifiers, which are just strings. The project template generated a diagnostic ID for you, and you are free to change it. The code in the property just returns the ID from the analyzer class.
Copy file name to clipboardExpand all lines: gamedev/unreal/get-started/vs-tools-unreal-add-class-module-plugin.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ To add an Unreal Engine class in Visual Studio, follow these steps after complet
57
57
58
58
1. In **Solution Explorer**, choose a folder where you want the new class to go. In the LyraStarterGame project, you could add a new class to the **LyraStarterGame** > **Source** folder, for example.
59
59
1. Right-click the folder and choose **Add** > **Unreal Engine item...** to open the **Add New Item** dialog:
60
-
:::image type="complex" source="../media/vs-add-new-unreal-engine-item-dialog-class.png" alt-text="A screenshot of the Add New Item dialog.":::
60
+
:::image type="complex" source="../media/vs-add-new-unreal-engine-item-dialog-class.png" alt-text="A screenshot of the Add New Item dialog, with Unreal Engine Common Classes selected.":::
61
61
It has options for adding an Unreal Engine Common Classes (which is selected), Empty Unreal Engine Module, and Unreal Engine Plugins.
62
62
:::image-end:::
63
63
1. Choose **Unreal Engine Common Classes** and then choose **Add** to open the **Add Unreal Engine Class** dialog:
@@ -78,7 +78,7 @@ To add an Unreal Engine plugin in Visual Studio, follow these steps after comple
78
78
79
79
1. In **Solution Explorer**, choose a folder where you want the new plugin to go. In the LyraStarterGame project, you could add a new plugin to the **LyraStarterGame** > **Source** folder, for example.
80
80
1. Right-click the folder and choose **Add** > **Unreal Engine item...** to open the **Add New Item** dialog:
81
-
:::image type="complex" source="../media/vs-add-new-unreal-engine-item-dialog-plugin.png" alt-text="A screenshot of the Add New Item dialog.":::
81
+
:::image type="complex" source="../media/vs-add-new-unreal-engine-item-dialog-plugin.png" alt-text="A screenshot of the Add New Item dialog, with Unreal Engine Plugins selected.":::
82
82
It has options for adding an Unreal Engine Common Classes, Empty Unreal Engine Module, and Unreal Engine Plugins (which is selected).
83
83
:::image-end:::
84
84
1. Choose **Unreal Engine Plugins** and then choose **Add** to open the **Add Unreal Engine Plugin** dialog:
@@ -96,4 +96,4 @@ To add an Unreal Engine plugin in Visual Studio, follow these steps after comple
96
96
[Visual Studio Tools for Unreal Engine](./vs-tools-unreal-overview.md)\
97
97
[View Unreal Engine Blueprints in Visual Studio](vs-tools-unreal-view-blueprints.md)\
98
98
[View Unreal Engine logging in Visual Studio](vs-tools-unreal-logging.md)\
99
-
[View Unreal Engine macros in Visual Studio](vs-tools-unreal-view-macros.md)
99
+
[View Unreal Engine macros in Visual Studio](vs-tools-unreal-view-macros.md)
0 commit comments