Question

I am currently populating my WPF grid using a data collection that implements ITypedList, with the contained entities implementing ICustomTypeDescriptor. All the properties are determined at runtime.

I'm wanting to implement HyperDescriptor to help speed up performance, but the example on that page more refers to known types rather than runtime properties.

I would think that I'd need to implement a custom GetProperties() method or similar to tell the HyperTypeDescriptor what properties it needs to look at, but am not sure where that should be set. I figure it's not difficult, but I'm obviously missing something.

Any tips much appreciated!

Was it helpful?

Solution

The HyperDescriptor implementation is indeed specific for compile-time properties, as it uses ILGenerator etc and caches the generated code. If you are using ICustomDescriptor you are already in a very different performance profile - for example, if your custom PropertyDescriptors work against a dictionary or hash-table as a property-bag they may already be significantly faster than raw reflection.

It may be possible to further optimise it, but I'd need to know more about the specific implementation. But it would be non-trivial work, so first satisfy yourself that this member-access is actually a bottleneck, and that you couldn't do something simple like paging or "virtual mode" first.

(clarification: I'm the author of HyperDescriptor, so I know this area well)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top