c# - Reading file's content and assigning it List <String> -
what trying achieve:
want read text file , store in list of strings. use second list of string save if found using regex
i dont know how tackle problem have done far.
using (streamreader content = new streamreader(@file_to_read)) { list <string> newline = new list <string> (); string line; while (line = content.readline()) != null) //add line list newline.add(line); } lets there text called 'causes' in of lines.what want iterate through list or lines whatever easy , store line in new list.
you can filter list this
list<string> newlist = newline.where(x => x.contains("your string match")).tolist();
Comments
Post a Comment