Metonymy is based on a different type of relation between the dictionary and contextual meanings, a relation based not on affinity, but on some kind of association connecting the two concepts which these meanings represent on a proximity
The proximity may be revealed:
1) between the symbol and the thing it denotes;
2) in the relations between the instrument and the action performed with this instrument;
e.g. His pen is rather sharp.
3) in the relation between the container and the thing it contains; e.g. He drank one more cup.
4) the concrete is put for the abstract;
e. g. It was a representative gathering (science, politics).
5) a part is put for the whole;
e.g. the crown - king, a hand - worker.
Metonymy represents the events of reality in its subjective attitude. Metonymy in many cases is trite.
e.g.:" to earn one's bread", "to keep one's mouth shut".
Irony is a stylistic device also based on the simultaneous realization of two logical meanings - dictionary and contextual, but the two meanings are in opposition to each other. The literal meaning is the opposite of the intended meaning. One thing is said and the other opposite is implied.
e.g. Nice weather, isn't it? (on a rainy day).