A wide array of operators are provided with the C# language, including many operators that are familiar to C and C++ programmers. C# also provides operators that go beyond C and C++, such as operators for performing full logical evaluations and operators for obtaining type information. C# also provides several techniques for enhancing your user-defined types so that they’re easier to use. By overloading operators for your types, you can give your types behavior that matches that of built-in types.

When values are converted to a new type, the process is managed by a type conversion operator. When you define conversion operators for your types, they can be declared as either implicit or explicit. Implicit operators can be invoked silently and shouldn’t result in a loss of data; explicit operators must be explicitly invoked and are used when a conversion might result in data loss.

Properties look like fields to the user, but they look like methods when added to your class or structure. This versatility simplifies the programming model for the consumer, because the consumer can access the property using the same syntax as is used to directly access a field. Meanwhile, the supplier is able to decouple the property name from the implementation of the property, much like access methods provided in other languages.

Chapter 5 introduces statements used to control the flow of execution, which enable you to write more sophisticated code than we’ve written thus far. C# includes a number of statements that support iteration, conditional execution, and transferring control within your application.

Part III: Programming Windows Forms