开发者

TypeDescriptionProvider / HyperDescriptor implementation

I am currently populating my WPF grid using a data collection that implements ITypedList, with the contained entities implementing ICustomTypeD开发者_运维百科escriptor. 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!


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜