以下是引用片段: public bool ProcessIterations (int numIters) { Debug.Assert (numIters > 0, "ProcessIterations.", "Iterations must be more than 0"); // More code... |
以下是引用片段: private void ImOK () { Debug.Assert (this != null, "Testing Object State", "this cannot be null"); // More here. } |
以下是引用片段: public bool ProcessIterations (int numIters) { ImOK (); Debug.Assert (numIters > 0, "ProcessIterations.", "Iterations must be more than 0");} |
以下是引用片段: public class MyClass { private static TraceSwitch myClassSwitch = new TraceSwitch ("MyClassSwitch", "Controls the \ debug output of MyClass");} |
以下是引用片段: public bool ProcessIterations (int numIters) { WriteLineIf (myClassSwitch.TraceInfo, "Entering ProcessIterations", "CallTrace"); ImOK (); Debug.Assert (numIters > 0, "ProcessIterations.", "Iterations must be more than 0");} |
以下是引用片段: <?xml version="1.0"?> <configuration> <system.diagnostics> <switches> <add name="MyClassSwitch" value="4" /> </switches> </system.diagnostics> </configuration> |
以下是引用片段: static void Main () { Debug.Listeners.Add ( New TextWriteTraceListener ("MyLog.log"); // etc. |
欢迎光临 南昌大学|中正论坛 (http://ncu.myubbs.com/) | Powered by Discuz! X3.3 |