Component-Oriented Development

Because C# is designed to develop components, it has many features that make developing and using components easier.

Properties

Users like simplicity when they deal with objects. When dealing with a button on a form, for example, users like to write code such as

cancelButton.caption = "Cancel"; 

where the caption field of the button is directly accessed. This is also efficient code, as the field is directly modified.

Unfortunately, this simple model makes things more difficult for the user. The point of updating the caption on a button is to actually change the caption. Because the user is directly modifying the field, however, the framework author is forced to add another step to the process:

 cancelButton.caption ...

Get Programming in the .NET Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.