locked
How to get reference to array RRS feed

  • Question

  • I have the following code

    strTemp = cItem["AttachmentDates"].ToString();
    string[] Lines = strTemp.Split(new string[] { "\r","\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
    Array theArray = Lines.OrderByDescending(d => d).ToArray();

    (there is 4 sub lines in theArray 0 -3). However, when I do theArray[0], I got error?

    Please advise how to reference these 4 lines. Many thanks.

    Wednesday, December 16, 2020 10:24 PM

Answers

  • I found a solution for myself. Here is may solution (convert an array to list)

    List<string> lst = theArray.OfType<string>().ToList();

    Now, I can access the list item such as  lst[1].

    • Marked as answer by eg10013 Friday, December 18, 2020 9:27 PM
    Friday, December 18, 2020 9:27 PM

All replies