assuming you’ve already converted it to a string, you can use the string.split() function. This is using c#.
sting yourtextfile;
//make all the different sections the same
yourtextfile.replace("#main", "#");
yourtextfile.replace("#extra", "#");
yourtextfile.replace("!side", "#");
//make all the arrays
string[] all = yourtextfile.Split('#');
string[] main = all[0].Split('\n');
string[] extra = all[1].Split('\n');
string[] side = all[2].Split('\n');
Afterwards, convert the arrays to lists, and you have the three lists you wanted.
2
solved adding each line in a text file into a list c# [duplicate]