What is the difference between PropertyType and ComponentType on a .NET PropertyDescriptor?
The docs didn’t really explain
PropertyType When overridden in a derived class, gets the type of the property.
ComponentType When overridden in a derived class, gets the type of the component this property is bound to.
In terms of a regular property:
If we now look at
Foo.BarviaTypeDescriptor, the component-type isFoo; the property-type isInt32. Basically,ComponentTypeis theDeclaringTypeof the property (in reflection terms). So if you are writing a customPropertyDescriptorimplementation, thePropertyTypeis the type of the data, andComponentTypeis the expected type of the target instance.