Skip to content

Commit 7b1389d

Browse files
WilliamAntonRohmmairaw
authored andcommitted
Console.WriteLine -- updating samples for Try .NET (#1641)
* updating for Try .NET * Update snippets/csharp/VS_Snippets_CLR_System/system.Console.WriteLine/CS/WriteLine6.cs Co-Authored-By: Maira Wenzel <[email protected]> * Reverting Try .NET change * Touch-up
1 parent be11327 commit 7b1389d

File tree

5 files changed

+43
-44
lines changed

5 files changed

+43
-44
lines changed
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
// <Snippet6>
2-
using System;
1+
using System;
32

43
public class Example
54
{
65
public static void Main()
76
{
7+
// <Snippet6>
88
Random rnd = new Random();
99
// Generate five random Boolean values.
1010
for (int ctr = 1; ctr <= 5; ctr++) {
1111
Boolean bln = Convert.ToBoolean(rnd.Next(0, 2));
1212
Console.WriteLine("True or False: {0}", bln);
1313
}
14+
15+
// The example displays an output similar to the following:
16+
// True or False: False
17+
// True or False: True
18+
// True or False: False
19+
// True or False: False
20+
// True or False: True
21+
// </Snippet6>
1422
}
1523
}
16-
// The example displays the following output:
17-
// True or False: False
18-
// True or False: True
19-
// True or False: False
20-
// True or False: False
21-
// True or False: True
22-
// </Snippet6>
23-
24-
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <Snippet7>
1+
// <Snippet7>
22
using System;
33

44
public class Example
@@ -9,7 +9,5 @@ public static void Main()
99
}
1010
}
1111
// The example displays output like the following:
12-
// Today's date: Friday, April 1, 2016
12+
// Today's date: Monday, April 1, 2019
1313
// </Snippet7>
14-
15-

snippets/csharp/VS_Snippets_CLR_System/system.Console.WriteLine/CS/newline1.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// <Snippet2>
2-
using System;
1+
using System;
32

43
public class Example
54
{
65
public static void Main()
76
{
7+
// <Snippet2>
88
string[] lines = { "This is the first line.",
99
"This is the second line." };
1010
// Output the lines using the default newline sequence.
@@ -22,19 +22,20 @@ public static void Main()
2222
Console.WriteLine();
2323
foreach (string line in lines)
2424
Console.WriteLine(line);
25+
26+
// The example displays the following output:
27+
// With the default new line characters:
28+
//
29+
// This is the first line.
30+
// This is the second line.
31+
//
32+
// With redefined new line characters:
33+
//
34+
//
35+
//
36+
// This is the first line.
37+
//
38+
// This is the second line.
39+
// </Snippet2>
2540
}
2641
}
27-
// The example displays the following output:
28-
// With the default new line characters:
29-
//
30-
// This is the first line.
31-
// This is the second line.
32-
//
33-
// With redefined new line characters:
34-
//
35-
//
36-
//
37-
// This is the first line.
38-
//
39-
// This is the second line.
40-
// </Snippet2>

snippets/csharp/VS_Snippets_CLR_System/system.Console.WriteLine/CS/writeline_boolean1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// <Snippet4>
2-
using System;
1+
using System;
32

43
public class Example
54
{
65
public static void Main()
76
{
7+
// <Snippet4>
88
// Assign 10 random integers to an array.
99
Random rnd = new Random();
1010
int[] numbers = new int[10];
@@ -18,6 +18,6 @@ public static void Main()
1818
Console.WriteLine(even);
1919
Console.WriteLine();
2020
}
21+
// </Snippet4>
2122
}
2223
}
23-
// </Snippet4>

snippets/csharp/VS_Snippets_CLR_System/system.Console.WriteLine/CS/writeline_obj1.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
// <Snippet3>
2-
using System;
1+
using System;
32

43
public class Example
54
{
65
public static void Main()
76
{
7+
// <Snippet3>
88
Object[] values = { true, 12.632, 17908, "stringValue",
99
'a', 16907.32m };
1010
foreach (var value in values)
1111
Console.WriteLine(value);
12+
13+
// The example displays the following output:
14+
// True
15+
// 12.632
16+
// 17908
17+
// stringValue
18+
// a
19+
// 16907.32
20+
// </Snippet3>
1221
}
1322
}
14-
// The example displays the following output:
15-
// True
16-
// 12.632
17-
// 17908
18-
// stringValue
19-
// a
20-
// 16907.32
21-
// </Snippet3>

0 commit comments

Comments
 (0)