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?
Printable View
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?
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.
Well Debug.Write writes to the output window, if you want something to write to the console try this.
Of if you want to handle it manually from Debug.WriteLine(). You could possibly make a TraceListener. Not sure how though.Code:[Conditional("DEBUG")]
static void DebugConsoleWrite(string str)
{
Console.Write(str);
}
static void Main(string[] args)
{
DebugConsoleWrite("hi");
Console.ReadKey();
}
So does Console.Write while debugging WinForms apps.Quote:
Originally Posted by high6
Well I meant Debug.Write doesn't output to the console window which is what it sounds like what he wants.
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.
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).
no
I can find if its refrenced
but if something is refrenced by something else that isnt used it didn't save me anything
Then... what's the problem? :confused:Quote:
Originally Posted by Crash893