C#: Is it wasteful to place Debug.Writeline text in a resource file?
I have the following: Debug.Writeline(Properties.Resources.DEBUG_MSG_1);
This works fine, and I can't imagine it hurting me in any way, shape, or form when compiling in Debug mode. However, I worry that although this is a nice and convenient way to manage my messages, it might be unnecessary overhead to include extra useless items in a resource file when I compile in Release. Is my ass开发者_JAVA百科umption correct?
The WriteLine
method has the attribute
[Conditional("DEBUG")]
set. Thus I strongly assume that the compiler removes the function call automatically for release builds.
Well... Resources are embedded to application. So in RELEASE you'll have some extra messages, which would not be used. The more you have them, the more will your application weights.
But I think that real problem might be someone reading DEBUG messages while she/he isn't supposed to do.
精彩评论