Click here to Skip to main content
15,905,144 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Anyone done fast reflection on compact framework?
Sergey Alexandrovich Kryukov 6-Jun-11 16:17pm    
You need to show your reflecting code and explain your ultimate goal. Perhaps in this case some optimization can be made.

Caching is really your best bet to achieve 'fast' reflection on the compact framework.
Share this answer
Mehdi Gholam 6-Jun-11 10:01am    
Caching is not really applicable I'm afraid. I want dynamic access to properties for fastJSON on netcf.
Sergey Alexandrovich Kryukov 6-Jun-11 16:24pm    
It is perfectly applicable and is a right way to improve things (maybe the only one).
Please see my explanation, ask a question if you need more detail.
Sergey Alexandrovich Kryukov 6-Jun-11 16:23pm    
I agree with you, but OP is confused. Your answer needs explanation of what you mean by caching. My 5, but...
Please see my explanation.
Andrew Rissing 7-Jun-11 9:22am    
Sometimes when people pose such broad questions without details, I just get it in me to reply in like with my answers. ;-)
There are several tricks to improve reflection. They are based on the fact that reflection methods are slower than some other and can be considered as caching: you create redundant meta-data which holds already reflected members, to avoid repeated calls to reflection methods. In ideal case, only invocation methods are calls are repeated (in case of JSON serialization, after all, it is unavoidable: eventually you need to create instances).

Share this answer
Mehdi Gholam 6-Jun-11 22:16pm    
Thanks man, what it boils down to is the fact that netcf has no support for emit, which I am currently using (incidentally silverlight 4 has added this which was great). I tried mono Cecil but can't get it to work. Maybe Cecil is my best bet and I need to work on it more.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900