How can I gain weight? I am very thin with weight of 45kg and tall 159cm

Resistance exercise. It is not advisable to simply add fat in order to gain weight. While you do sound of slight build, your body probably fits your build. If you do want to add weight, focus on lean body mass. The only way to build lean body mass (ie muscle) is with resistance exercises, ie lifting weights. Simply increasing your caloric intake to exceed your daily need will only add fat.
Diet & lift weights. To gain weight you have to consume more calories than you are burning. Do this in a healthy way though. Don't choose junk or fast food. Keep a well balanced diet and make sure you are getting all the nutrients you need. Don't cut out exercise as it is very good for you. Weight lifting and other muscle building exercises can help you increase your body mass.