Skip to content

Commit 34f5a6f

Browse files
String.xml samples -- updating per Try .NET review comments (#1916)
* updating per Try .NET review comments * undo one small change Co-authored-by: Maira Wenzel <[email protected]>
1 parent f117596 commit 34f5a6f

File tree

2 files changed

+8
-2
lines changed
  • snippets/csharp

2 files changed

+8
-2
lines changed

snippets/csharp/VS_Snippets_CLR/string.compare4/CS/comp4.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
//<snippet1>
21
// Sample for String.Compare(String, Int32, String, Int32, Int32, Boolean)
32
using System;
43

54
class Sample
65
{
76
public static void Main()
87
{
8+
//<snippet1>
99
String str1 = "MACHINE";
1010
String str2 = "machine";
1111
String str;
1212
int result;
1313

1414
Console.WriteLine();
1515
Console.WriteLine("str1 = '{0}', str2 = '{1}'", str1, str2);
16+
1617
Console.WriteLine("Ignore case:");
1718
result = String.Compare(str1, 2, str2, 2, 2, true);
1819
str = ((result < 0) ? "less than" : ((result > 0) ? "greater than" : "equal to"));
1920
Console.Write("Substring '{0}' in '{1}' is ", str1.Substring(2, 2), str1);
2021
Console.Write("{0} ", str);
2122
Console.WriteLine("substring '{0}' in '{1}'.", str2.Substring(2, 2), str2);
2223
Console.WriteLine();
24+
2325
Console.WriteLine("Honor case:");
2426
result = String.Compare(str1, 2, str2, 2, 2, false);
2527
str = ((result < 0) ? "less than" : ((result > 0) ? "greater than" : "equal to"));
@@ -37,6 +39,6 @@ public static void Main()
3739
Honor case:
3840
Substring 'CH' in 'MACHINE' is greater than substring 'ch' in 'machine'.
3941
*/
42+
//</snippet1>
4043
}
4144
}
42-
//</snippet1>

snippets/csharp/VS_Snippets_CLR_System/system.string.isnullorempty/cs/isnullorempty1.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ bool TestForNullOrEmpty(string s)
1616
string s2 = "";
1717
Console.WriteLine(TestForNullOrEmpty(s1));
1818
Console.WriteLine(TestForNullOrEmpty(s2));
19+
20+
// The example displays the following output:
21+
// True
22+
// True
1923
// </Snippet1>
2024
}
2125
}

0 commit comments

Comments
 (0)