Skip to content

Commit 4b24c92

Browse files
Fix typo and change postfix decrement operator to prefix increment op… (#7230)
* Fix typo and change postfix decrement operator to prefix increment operator * Update samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Compare5/cs/Example.cs Co-authored-by: Genevieve Warren <[email protected]> * Create Example.csproj Co-authored-by: Genevieve Warren <[email protected]>
1 parent f596824 commit 4b24c92

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Compare5/cs/Example.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ public static void Main()
99
string name1 = "Jack Smith";
1010
string name2 = "John Doe";
1111

12-
// Get position of space character.
12+
// Get position of character after the space character.
1313
int index1 = name1.IndexOf(" ");
14-
index1 = index1 < 0 ? 0 : index1--;
14+
index1 = index1 < 0 ? 0 : ++index1;
1515

1616
int index2 = name2.IndexOf(" ");
17-
index1 = index1 < 0 ? 0 : index1--;
17+
index2 = index2 < 0 ? 0 : ++index2;
1818

1919
int length = Math.Max(name1.Length, name2.Length);
2020

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
<LangVersion>8.0</LangVersion>
7+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
8+
</PropertyGroup>
9+
10+
</Project>

0 commit comments

Comments
 (0)