Newbie Question: Commented Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have quite a bit of commented code and old routines in my classes and
windows forms. To be sure, all of these extra lines (and there's quite a lot)
are "ignored" when compiling the executable, and essentially, have no effect
whatsoever, on the final application correct?

Thanks,
 
Comments which you use to document your code will be added to the
Intermediate Language Portable Executable ( PE File ) but will have no
affect as far as execution is concerned when being run on the Common
Language Runtime and Jitted into machine code.

Terry Burns
http://TrainingOn.net
 
I have tested with a comment in my source code and I have not found it in
the exe using an hex editor. Are you sure of that? What would be the purpose
of retaining comments in the IL language exe (as if IL itself wouldn´t be
enough threat to intellectual property rights) ?

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
charliewest said:
I have quite a bit of commented code and old routines in my classes and
windows forms. To be sure, all of these extra lines (and there's quite a lot)
are "ignored" when compiling the executable, and essentially, have no effect
whatsoever, on the final application correct?

Thanks,
The only "commented" part of your source code files which will be
handled by the C# compiler is the xml documentation, which is
"commented" out using triple slashes, ie.

/// <summary>
/// This method is just superb.
/// </summary>

The effect this has is:

1. Inside the project this comment is applied, using the identifier to
which it is applied will give you the documentation as part of code insight
2. if you specify a .xml file for the build process, the documentation
is exported to this xml file, and also checked according to some rules
for consistency with the code it is applied to. This xml file can then
be used by other projects to give the same effect as point 1 across
projects.

Everything else is, AFAIK, ignored completely, and will not have any
impact on your compiled assembly.
 
Back
Top