-7

I have a CSV list of player ID strings each on a different line. How do I go about storing each of the IDs in an array in C#?

8

1 Answer 1

2

You can start from this code, first read the file, second split the file since data is on different row, then store the result on array:

using (StreamReader sr = new StreamReader(@"C:\Folder\Book1.csv"))
        {
            string strResult = sr.ReadToEnd();
            string[] result = strResult.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
        }
Sign up to request clarification or add additional context in comments.

1 Comment

Cheers, this is exactly what I needed.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.