473,378 Members | 1,479 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Console.Write in Release mode

Hi,

Console.WriteLine does something on Release mode?

I have many of them in my application and I want to know if the performace
could be affected, on debug mode I can see a big difference between having
and not because I'm printing many of them on loops, etc.

Now, in Release mode Console.Writeline has something like #if (!Release),
send the string to something like "/dev/null" or it is executed internally
like a normal instruction.

Thanks,
Gustavo.

Nov 15 '05 #1
2 5857
Gustavo,
Console.WriteLine does something on Release mode?


Yes, how else would you write to the console in a release build?

You may want to look at Debug.WriteLine() instead, or wrap the
Console.WriteLine call in your own method that's decorated with
[Conditional("DEBUG")], or put the WriteLine calls inside #if DEBUG
#endif.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2
Another good idea is to use the Trace class, when you can decide during the
runtime of the Release, if the output is directed to anywhere using the
<trace> element of the application .config file.You can even declare your
own classes as output sinks using the <listeners> element.

Have a look at the following links:
http://msdn.microsoft.com/library/de...aceelement.asp
http://msdn.microsoft.com/library/de...erselement.asp

A higher level runtime tracing tool is EIF (Enterprise Instrumentation
Framework):
http://www.microsoft.com/technet/tre...pp/default.asp

Cezary Nolewajka
mailto:c.*********************@no-sp-am-eh-mail.com
remove all "no-sp-am-eh"s to reply

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uC**************@TK2MSFTNGP10.phx.gbl...
Gustavo,
Console.WriteLine does something on Release mode?


Yes, how else would you write to the console in a release build?

You may want to look at Debug.WriteLine() instead, or wrap the
Console.WriteLine call in your own method that's decorated with
[Conditional("DEBUG")], or put the WriteLine calls inside #if DEBUG
#endif.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jabailo | last post by:
This is driving me crazy. I finally got the Remoting sample chat application working almost. When I run the chat client in VS.NET it goes into an endless loop -- that's because I assume that...
1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
2
by: Boba | last post by:
Hi, I'm programming a WinForm application. I would like to enter commands that will send output that will help me to locate bugs in the future. I know that there is a way to send output by...
6
by: JM | last post by:
Hi, I need a function for a character based program (console) that works exactly like the INKEY$() function in (old) QBasic: Read only 1 keystroke and then move on. Console.Read;...
5
by: Sagaert Johan | last post by:
Hi Can a lot of Console.Writeline commands cause a program to run slower ? johan
8
by: Gaurav | last post by:
Hi All, I have written the 'c' code for specific purpose and tested it over many files and it is crashing in only one case. When I ran the same code in the debug mode within the VS against the...
5
by: Hooyoo | last post by:
Hi, here. I write following codes: string password = Console.ReadLine(); I want users enter their passwords, but readline will show content of password when entering, so is there any way to...
3
by: TC | last post by:
I'm trying to debug a console application, but I can't see the console output. I've seen many references which say that console output is supposed to appear on the Output window when the...
5
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.