- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathsource.cpp
33 lines (30 loc) · 808 Bytes
/
source.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#using <System.dll>
usingnamespaceSystem;
usingnamespaceSystem::Diagnostics;
public ref classTest
{
//<Snippet1>
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch^ generalSwitch =
gcnew TraceSwitch( "General","Entire Application" );
public:
staticvoidMyErrorMethod( Object^ myObject )
{
// Write the message if the TraceSwitch level is set to Error or higher.
if ( generalSwitch->TraceError )
{
#if defined(DEBUG)
Debug::Write( "Invalid object. " );
#endif
}
// Write a second message if the TraceSwitch level is set to Verbose.
if ( generalSwitch->TraceVerbose )
{
#if defined(DEBUG)
Debug::WriteLine( myObject );
#endif
}
}
//</Snippet1>
};