IT Community - Software Programming, Web Development and Technical Support

Trace and Assert

This is a discussion on Trace and Assert within the C# Programming forums, part of the Software Development category; Hui guys can anyone tell me How do I do implement a trace and assert?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-16-2007, 05:20 AM
vigneshgets vigneshgets is offline
D-Web Genius
 
Join Date: Mar 2007
Posts: 904
vigneshgets is on a distinguished road
Question Trace and Assert

Hui guys can anyone tell me How do I do implement a trace and assert?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-16-2007, 05:28 AM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 350
Venkat is on a distinguished road
Thumbs up Re: Trace and Assert

hey,

Use a conditional attribute on the method, as shown below:

class Debug

{

[conditional("TRACE")]

public void Trace(string s)

{

Console.WriteLine(s);

}

}

class MyClass

{

public static void Main()

{

Debug.Trace("hello");

}

}

In this example, the call to Debug.Trace() is made only if the preprocessor symbol TRACE is defined at the call site. You can define preprocessor symbols on the command line by using the /D switch. The restriction on conditional methods is that they must have void return type.
__________________
Venkat
knowledge is Power
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug class and Trace class simplesabita Software Testing 3 08-18-2007 12:30 AM
Trace files and Log Files in Unix vigneshgets Operating Systems 0 08-01-2007 05:18 AM
how it helps to increase the performance in asp .net Set trace enabled="false" oxygen ASP and ASP.NET Programming 1 07-20-2007 06:28 AM
Trace trace Introductions 0 07-20-2007 05:08 AM
Assert raj PHP Programming 1 07-16-2007 09:40 AM


All times are GMT -7. The time now is 10:39 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0