Let's say that I have to show some graphics on some control. But there will be three images switched based on some condition. Three bitmap is added in the resource file.
So, I retrieve them by calling ResourceManager.GetObject.
The question is that, should it be:
- Everytime I have to switch image, I call GetObject to get it and assign to the control or
- hold the result of GetObject for each image at the start, so that there will only ever be 3 calls to the GetObject. Assign image from my variables instead.
Doing 1) seems to produce a lot of GC Handle when viewed with CLR Profiler. Hoping to know any bad side effect of 2).
Thanks a lot.