Find icon size (screen resolution) through code

Hello,

Is it possible to use code to find the icon size (or resolution) for a device, similar to how you would find the screen height or width, and if so, how do I do that?  I know I can find them all in the resource devices page, but I would like to set up an action which depends on the icon size, and I would not wish to hard-code each part number as it would not be efficient.

I look forward to hearing your advice.