Skip to content

Commit c72b36e

Browse files
authored
fix sample code (#4408)
* fix sample output * feedback * feedback
1 parent 7eefead commit c72b36e

File tree

2 files changed

+4
-6
lines changed
  • samples/snippets
    • csharp/VS_Snippets_CLR_System/system.invalidoperationexception/cs
    • visualbasic/VS_Snippets_CLR_System/system.invalidoperationexception/vb

2 files changed

+4
-6
lines changed

samples/snippets/csharp/VS_Snippets_CLR_System/system.invalidoperationexception/cs/List_Sort2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public Person(String fName, String lName)
1616
public int CompareTo(Person other)
1717
{
1818
return String.Format("{0} {1}", LastName, FirstName).
19-
CompareTo(String.Format("{0} {1}", LastName, FirstName));
19+
CompareTo(String.Format("{0} {1}", other.LastName, other.FirstName));
2020
}
2121
}
2222

@@ -36,4 +36,4 @@ public static void Main()
3636
// The example displays the following output:
3737
// Jane Doe
3838
// John Doe
39-
// </Snippet13>
39+
// </Snippet13>

samples/snippets/visualbasic/VS_Snippets_CLR_System/system.invalidoperationexception/vb/List_Sort2.vb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Public Class Person : Implements IComparable(Of Person)
1616
Public Function CompareTo(other As Person) As Integer _
1717
Implements IComparable(Of Person).CompareTo
1818
Return String.Format("{0} {1}", LastName, FirstName).
19-
CompareTo(String.Format("{0} {1}", LastName, FirstName))
20-
End Function
19+
CompareTo(String.Format("{0} {1}", other.LastName, other.FirstName))
20+
End Function
2121
End Class
2222

2323
Module Example
@@ -36,5 +36,3 @@ End Module
3636
' Jane Doe
3737
' John Doe
3838
' </Snippet13>
39-
40-

0 commit comments

Comments
 (0)