Answered by:
How to get reference to array

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
-
I'd try asking for help over here.
dotnet-visual-basic - Microsoft Q&A
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.
- Edited by Dave PatrickMVP Wednesday, December 16, 2020 11:50 PM
- Proposed as answer by KHURRAM RAHIM Thursday, December 17, 2020 6:41 AM
Wednesday, December 16, 2020 10:44 PM -
Hi,
If you're doing some Office programming, I suggest asking over here:
https://social.msdn.microsoft.com/forums/office/en-us/home?category=officedevBest regards,
LeonBlog:
https://thesystemcenterblog.com LinkedIn:
Wednesday, December 16, 2020 10:45 PM -
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