Well sure, but attributes are a *different* way to talk to the compiler.
Saying x =1 is using the main programming language. Attributes do not.
From the article I referenced earlier:
"You may wonder why attributes are used on the .NET platform and why they
are not simply implemented as language elements. The answer comes from the
fact that attributes are stored as metadata in an assembly, rather than as
part of its executable code. As an item of metadata, the attribute describes
the program element to which it applies and is available through reflection
both at design time (if a graphical environment such as Visual Studio .NET
is used), at compile time (when the compiler can use it to modify,
customize, or extend the compiler's basic operation), and at runtime (when
it can be used by the Common Language Runtime or by other executable code to
modify the code's ordinary runtime behavior)."
-Scott
Jack Jackson said:
Sure, but:
x = 1
is an instruction to the compiler to generate some IL. By your
definition, how is that different from what an attribute does, except
that one affects metadata and the other IL.