That is a more fundamental question.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for your feedback, @LJ9999.
There's a general description of attributes and the reasons for using them in the top-level Extending metadata using attributes article, as well as in the Attribute class documentation. Attributes are stored as metadata, are discoverable through reflection, and support custom behavior of program elements such as assemblies, types, and methods. They are typically used by tools or the common language runtime itself. For example, the ObsoleteAttribute is used by language compilers to determine whether the use of that program element generates a compiler warning or error. The FlagsAttribute modifies the behavior of the ToString method of enumeration types.
Although the existing content that discusses why attributes are used could be improved, it is at least adequate. I'm going to close this issue as Not Repro.
You can also find an answer to your question at https://stackoverflow.com/questions/2295119/when-should-i-use-attribute-in-c
Most helpful comment
Thanks for your feedback, @LJ9999.
There's a general description of attributes and the reasons for using them in the top-level Extending metadata using attributes article, as well as in the Attribute class documentation. Attributes are stored as metadata, are discoverable through reflection, and support custom behavior of program elements such as assemblies, types, and methods. They are typically used by tools or the common language runtime itself. For example, the ObsoleteAttribute is used by language compilers to determine whether the use of that program element generates a compiler warning or error. The FlagsAttribute modifies the behavior of the ToString method of enumeration types.
Although the existing content that discusses why attributes are used could be improved, it is at least adequate. I'm going to close this issue as Not Repro.