Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Assertions/C-sharp/assertions-1.cs
Normal file
21
Task/Assertions/C-sharp/assertions-1.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System.Diagnostics; // Debug and Trace are in this namespace.
|
||||
|
||||
static class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
int a = 0;
|
||||
|
||||
Console.WriteLine("Before");
|
||||
|
||||
// Always hit.
|
||||
Trace.Assert(a == 42, "Trace assertion failed");
|
||||
|
||||
Console.WriteLine("After Trace.Assert");
|
||||
|
||||
// Only hit in debug builds.
|
||||
Debug.Assert(a == 42, "Debug assertion failed");
|
||||
|
||||
Console.WriteLine("After Debug.Assert");
|
||||
}
|
||||
}
|
||||
21
Task/Assertions/C-sharp/assertions-2.cs
Normal file
21
Task/Assertions/C-sharp/assertions-2.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Imports System.Diagnostics
|
||||
' Note: VB Visual Studio projects have System.Diagnostics imported by default,
|
||||
' along with several other namespaces.
|
||||
|
||||
Module Program
|
||||
Sub Main()
|
||||
Dim a As Integer = 0
|
||||
|
||||
Console.WriteLine("Before")
|
||||
|
||||
' Always hit.
|
||||
Trace.Assert(a = 42, "Trace assertion failed: The Answer was incorrect")
|
||||
|
||||
Console.WriteLine("After Trace.Assert")
|
||||
|
||||
' Only hit in debug builds.
|
||||
Debug.Assert(a = 42, "Debug assertion failed: The Answer was incorrect")
|
||||
|
||||
Console.WriteLine("After Debug.Assert")
|
||||
End Sub
|
||||
End Module
|
||||
1
Task/Assertions/C-sharp/assertions-3.cs
Normal file
1
Task/Assertions/C-sharp/assertions-3.cs
Normal file
|
|
@ -0,0 +1 @@
|
|||
Trace.Listeners.Add(new ConsoleTraceListener())
|
||||
Loading…
Add table
Add a link
Reference in a new issue