- Home /
Duplicate Question
How to put each line of a text file into a separate sring c#
I have a text file created and added to in c#. I want to know how I can than get that information and store aech line of the text document in separate strings.
Answer by ShadoX · Sep 02, 2013 at 07:27 AM
You could try reading all the info from the file via http://msdn.microsoft.com/en-us/library/vstudio/ezwyzy7b.aspx into an ArrayList.
I already made all the variables; (because each variable is displayed on a GUI button) I want to put each line into a totally separate variable. Thanks.
@ShadoX: You wouldn't ever want to use an ArrayList. Use a built-in array, or a generic List.
@$$anonymous$$H1: You really don't want to use separate variables; that's a nightmare. Use arrays or lists.
$$anonymous$$y bad,I don't usually use C# so I was pretty much just looking for something where you don't have to define the list size. Thanks for the info @Eric5h5
@Fattie: please never convert my comments into answers. They are comments because they don't answer the question, they are commenting on someone else's answer. How in the world would my previous comment make sense as an answer out of context? Hint: it doesn't!
Follow this Question
Related Questions
A little bit of help is needed!!! 1 Answer
Remove the & at the end of concatenated string 0 Answers
Ui text to string ? 1 Answer
String.Remove not working 1 Answer
Best way to manage stats in a text file 2 Answers