- Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathsource.cpp
25 lines (22 loc) · 747 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
#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, String^ category )
{
// Write the message if the TraceSwitch level is set to Error or higher.
#if defined(DEBUG)
Debug::WriteIf(generalSwitch->TraceError, "Invalid object for category. ");
// Write a second message if the TraceSwitch level is set to Verbose.
Debug::WriteLineIf( generalSwitch->TraceVerbose, myObject, category );
#endif
}
// </Snippet1>
};