Attributes are not automatically created when the application starts. The only way to see which types (or any element of the IL, for that matter) has the attribute used is to iterate over everything and check one by one. Therefore, attributes cannot automatically control the program.
This is mainly metadata related to some things. Their constructor is called when reflection creates an instance of the attribute class that represents the attribute at run time. This only happens when you request a reflection for this (using the Type.GetCustomAttributes method.)
Mehrdad afshari
source share