|
-
Dec 7th, 2008, 05:40 PM
#1
Thread Starter
Fanatic Member
is console.writeline(""); compiled at runtime?
I'm not sure if i phrased the question right or not but if i wanted to put in a bunch of console.write commmands in diffrent subs for trouble shooting at debug
would it be compiled into the runtime exe or is it something that is just for debug?
-
Dec 7th, 2008, 07:54 PM
#2
Re: is console.writeline(""); compiled at runtime?
Yes it would. Use Debug.Write for debugging. It will not be compiled into a Release build so they can be left in your code permanently without affecting performance.
-
Dec 7th, 2008, 09:16 PM
#3
Frenzied Member
Re: is console.writeline(""); compiled at runtime?
Well Debug.Write writes to the output window, if you want something to write to the console try this.
Code:
[Conditional("DEBUG")]
static void DebugConsoleWrite(string str)
{
Console.Write(str);
}
static void Main(string[] args)
{
DebugConsoleWrite("hi");
Console.ReadKey();
}
Of if you want to handle it manually from Debug.WriteLine(). You could possibly make a TraceListener. Not sure how though.
-
Dec 7th, 2008, 09:55 PM
#4
Re: is console.writeline(""); compiled at runtime?
 Originally Posted by high6
Debug.Write writes to the output window
So does Console.Write while debugging WinForms apps.
-
Dec 7th, 2008, 10:05 PM
#5
Frenzied Member
Re: is console.writeline(""); compiled at runtime?
Well I meant Debug.Write doesn't output to the console window which is what it sounds like what he wants.
-
Dec 9th, 2008, 02:16 AM
#6
Thread Starter
Fanatic Member
Re: is console.writeline(""); compiled at runtime?
Tell me if im crazy
I am updateing a program that I inherited from someone else.
I wanted to add console.writeline(Method XXX start); and a matching end to the begining and end of each method in this program
then run it through a few times doing everything that the program does then see if any of the methods in the program are completely unused.
this sounds crazy but ive already found 4 that are completely unused. ( It looks like the orginal programer made them then made replacement or updated methods but forgot to delete the older ones)
but i don't want it to affect the app in terms of speed some im thinking of something i could do.
-
Dec 9th, 2008, 08:27 AM
#7
Not NoteMe
Re: is console.writeline(""); compiled at runtime?
In Visual studio you can right-click on a method and 'Find all references', this could give an indication as to whether it's used (at least from within the current project).
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Dec 9th, 2008, 04:39 PM
#8
Thread Starter
Fanatic Member
Re: is console.writeline(""); compiled at runtime?
no
I can find if its refrenced
but if something is refrenced by something else that isnt used it didn't save me anything
-
Dec 10th, 2008, 10:06 AM
#9
Re: is console.writeline(""); compiled at runtime?
 Originally Posted by Crash893
but if something is refrenced by something else that isnt used it didn't save me anything
Then... what's the problem?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|