many people try avoiding weight gain but if you need to try to change your diet.
I don't know if this is a medical answer but in my 57years I've gained and lost weight in amounts of 30to75lbs keeping it on,or off for years at a time. All mainly by following my body clock. For me that means to lose I eat between 6am and 6pm and when I gain its usually a result of eating late at night. And most often carbs and fats.
Okay dearies I'm grateful
You need to establish why you are thin.
To gain weight a person has to consume more calories that they burn off.
If you are not eating much or have a poor appetite, you need to see your doctor if you are anaemic. Having anaemia will give you a loss of appetite and if you have no appetite you will not feel like eating.
It may be that you are genetically meant to be thin.
If you are eating a lot and still not gaining weight, it could be that there is either a problem with your digestion, metabolism or sometimes by having a parasite like a tape worm.
If you have been very ill have lost weight because of that, you need to eat a healthy and well balanced diet and slowly increase the portion sizes, but do not eat to the point that you feel full. Listen to what your body says. It takes 20 minutes for your body to send you a signal that you have eaten enough, so do eat slowly and don't eat so much that it will make you feel sick.
I suggest you make an appointment to see your doctor to find out if there are any medical reasons why you are not gaining weight (or losing it without trying) and also for referral to a dietician.
Best wishes.
See your doctor to ascertain the reason for your thinness, it could be a hyper-thyroid condition or some other issue.