Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
// <Snippet6>
using System;
using System;

public class Example
{
public static void Main()
{
// <Snippet6>
Random rnd = new Random();
// Generate five random Boolean values.
for (int ctr = 1; ctr <= 5; ctr++) {
Boolean bln = Convert.ToBoolean(rnd.Next(0, 2));
Console.WriteLine("True or False: {0}", bln);
}

// The example displays the following output:
// True or False: False
// True or False: True
// True or False: False
// True or False: False
// True or False: True
// </Snippet6>
}
}
// The example displays the following output:
// True or False: False
// True or False: True
// True or False: False
// True or False: False
// True or False: True
// </Snippet6>


Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// <Snippet7>
using System;
using System;

public class Example
{
public static void Main()
{
// <Snippet7>
Console.WriteLine("Today's date: {0:D}", DateTime.Now);

// The example displays output like the following:
// Today's date: Friday, April 1, 2019
// </Snippet7>
}
}
// The example displays output like the following:
// Today's date: Friday, April 1, 2016
// </Snippet7>


Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// <Snippet2>
using System;
using System;

public class Example
{
public static void Main()
{
// <Snippet2>
string[] lines = { "This is the first line.",
"This is the second line." };
// Output the lines using the default newline sequence.
Expand All @@ -22,19 +22,20 @@ public static void Main()
Console.WriteLine();
foreach (string line in lines)
Console.WriteLine(line);

// The example displays the following output:
// With the default new line characters:
//
// This is the first line.
// This is the second line.
//
// With redefined new line characters:
//
//
//
// This is the first line.
//
// This is the second line.
// </Snippet2>
}
}
// The example displays the following output:
// With the default new line characters:
//
// This is the first line.
// This is the second line.
//
// With redefined new line characters:
//
//
//
// This is the first line.
//
// This is the second line.
// </Snippet2>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// <Snippet4>
using System;
using System;

public class Example
{
public static void Main()
{
// <Snippet4>
// Assign 10 random integers to an array.
Random rnd = new Random();
int[] numbers = new int[10];
Expand All @@ -18,6 +18,6 @@ public static void Main()
Console.WriteLine(even);
Console.WriteLine();
}
// </Snippet4>
}
}
// </Snippet4>
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// <Snippet3>
using System;
using System;

public class Example
{
public static void Main()
{
// <Snippet3>
Object[] values = { true, 12.632, 17908, "stringValue",
'a', 16907.32m };
foreach (var value in values)
Console.WriteLine(value);

// The example displays the following output:
// True
// 12.632
// 17908
// stringValue
// a
// 16907.32
// </Snippet3>
}
}
// The example displays the following output:
// True
// 12.632
// 17908
// stringValue
// a
// 16907.32
// </Snippet3>