Hi,
It's not the capacitance itself that dissipates energy as heat, as capacitance is a storage container which can store and supply energy without loss. The problem is, it's hard to charge a capacitance without using some power because the various other components used to charge the cap have resistance, and that resistance is what eats up the energy when the capacitance is charged (or discharged).
Thus, as an exercise to figure out how much energy is dissipated you only need to figure out what gets lost in the resistance, and then generalize for any resistance, switching frequency, etc.
The resistance comes in the form of cap ESR and MOS transistor 'on' resistance, but also from the source impedance.