In this chapter, you learned about the main arithmetic operators along with the string, char, and enumerator types.
What follows are the important points covered in this chapter.
Arithmetic operators combine with operands to form arithmetic expressions.
Binary operators operate on two operands. Unary operators operate on one operand.
An operand can be any arithmetic expression, so any longer arithmetic expression can be broken into simple expressions consisting of binary and unary operators and their operands. The compiler evaluates any arithmetic expression by following this process while observing the precedence and associativity rules of the included operators. This evaluation process often gives the same result as when we apply the arithmetic rules we learned in school.
Apply parentheses when the precedence and associativity rules do not correspond with your calculations. (This also makes the code more clear.)
The modulus operator is useful for solving many more computational problems than its simple appearance indicates.
Any expression written with increment (++) and decrement (--) operators can be written without these unary operators. If not used with caution, they can easily lead to unclear and erroneous code.
To find the type of an expression the types of its sub-expressions are passed through, the expression hierarchy, just like the values of its sub-expressions, are passed through to find its value. If we know the type of any two operands and their binary operator and any one operand and its unary operator, we can combine these types to find the type of any longer expression.
A flowchart is a diagramming technique often used to express algorithms. A flowchart was used to describe the process followed by the compiler when it determines the type of two operands and a binary operator.
C#'s built-in support for metadata allows for a separation between hard-coded rigid standards pertaining to the C# language and a user friendly, flexible description of the source code and its types. This allows C# components to be useful in many different environments.
Enumerated constants are useful when we need to represent a finite set of related constants whose values are known before the program is compiled.
A value of type char represents a Unicode character. A value of type string represents a list of char values. The string class contains many valuable methods to manipulate strings of characters.