Explicit – additional adornment of code
Pretty much all code elements can have additional information added to them. These are called attributes. Attributes are a powerful method of associating metadata with the element. Within the .NET framework itself, you’ll see quite a few of these attribute types that can be used.
In the System.ComponentModel.DataAnnotations namespace, you can find some great examples of attributes that add metadata used by the runtime. Here, you’ll find attributes used for adding validation metadata. ASP.NET picks up the usage of these attributes and checks objects being sent to controller actions for validity according to the rules applied. As we saw briefly in Chapter 1, How Can Metaprogramming Benefit You?, with our RegisterPerson type, we could instruct properties that should be required. It contains much more, for instance, [StringLength] and [Range]. These are great examples of metadata recognized by the framework and components...