I generated some of my C# code with an external tool. Each generated class has an attribute GeneratedCodeAttribute. Why is my generator creating this attribute?
This attribute was set because this code is generated by tool, not by human :) what is use of it you might ask? MSDN tells us:
The GeneratedCodeAttribute class can be used by code analysis tools to identify computer-generated code, and to provide an analysis based on the tool and the version of the tool that generated the code.
The first link is its documentation and the second link is a detailed description of what this is for, why code generators produce it, and how code analyzers consume it.
http://msdn.microsoft.com/en-us/library/system.codedom.compiler.generatedcodeattribute.aspx
and
https://blogs.msdn.microsoft.com/codeanalysis/2007/04/27/correct-usage-of-the-compilergeneratedattribute-and-the-generatedcodeattribute/
Does that answer your question?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With