O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Attributes

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required