How to detect Page Editor mode in Sitecore through code

f you are a Sitecore developer then definitely in many instances you would need to show or hide some components in the Page Editor mode. So How to detect Page Editor mode in Sitecore...