When you declare a variable to of type int, specify a method to be public, or specify a class to be a subclass of another class called, say, Shape, you are adding declarative information to each of these elements (the variable, method, and class). As mentioned in Chapter 6, “Types Part I: The Simple Types,” declarative information can be compared to telling someone what to do, whereas the following imperative statement:

sum = number1 + number2;

is similar to telling someone how to do something (how to calculate the sum of two numbers). The “what” is significantly more expressive than the “how,” so your ability to decorate code elements with additional information (adding declarative information) is a powerful concept.

Rather than ...

Get C# Primer Plus now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.