If a directs to do an act in certain manner, it necessarily prohibits doing of the act in any other manner.

If a statute has conferred a power to do an act and has laid down the method in which that power has to be exercised, it necessarily prohibits the doing of the act in any other manner than that which has been prescribed.

The principle behind the Rule is that if this were not so, the statutory provision might as well not have been enacted. A Magistrate, therefore, cannot in the course of investigation record a confession except in the manner laid down in Section 164. The power to record the confession had obviously been given so that the confession might be proved by the record of it made in the manner laid down. If proof of the confession by other means was permissible, the whole provision of Section 164 including the safeguards contained in it for the protection of Accused persons would be rendered nugatory. The section, therefore, by conferring on Magistrates the power to record statements or confessions, by necessary implication, prohibited a Magistrate from giving oral evidence of the statements or confessions made to him.

Municipal Corporation of Greater Mumbai (MCGM) Vs. Abhilash Lal & Ors-15/11/2019