In Hamlet, Hamlit actually makes 4 soliloquies. I suppose you are referring to one soliloquy "to be or not to be." In this soliloquy, Hamlet shows his melacholy through his skillful use of rehtorical devices such as metaphors as well as his confusion between death and living. So far as metaphor is concerned, there are a number of expressions such as "a sea of troubles" "slings and arrows of outrageous fortune." Moreover, his concern of death and living tells his melancholic nature towards the world. He thinks that the world is a kind of place full of "the law's delay, the pangs of despised love." However, before death, "the native hue of the enterprises of the moment and pitch turns awry.