Summary:
In his previous article, Morgan Skinner looked at the TypeDescriptor class, and how it could be used to retrieve various pieces of information from a type (or object). In certain situations however, you might want to augment or bypass the information returned from the TypeDescriptor, and in order to do this you need to implement the ICustomTypeDescriptor interface on your type. In this article, Morgan examines the ICustomTypeDescriptor interface, and show some examples of where it might be used, such as to to construct a list of properties on the fly when reading records from a database and displaying them on screen. Using the ICustomTypeDescriptor interface, it is possible to give each record its own list of properties, which might be useful if you want to permit or deny access to those properties based on some row level security settings. |