TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
scott oliver
NA
82
16.3k
How to pull the number of items in a string array
Oct 13 2020 1:14 PM
Hello all first off I want to thank everyone who has assisted me on this project. I am now at a point I am trying to get how many items are in this string[].
Another user on this board helped me with the following code. It uses restsharp to download a csv file and it puts the values in an array to insert into a sqlite db. There is about 12,000 items, and at the end of the file I get an error about an out of bounds value. Its because its blank. What I think I need to do is get the number of items then break the foreach loop. If there is 12500 items I probably need to break on the 12499 item. I also want to add a progress bar. Here is the code the other user assisted with.
In the Locals Watch I see there are 12294 items
{string[12294]}
Thank you again for any help. I have not programmed in years, and it seems my memory is not what it used to be.
//the csv request
IRestResponse response = restSharpClient.Execute(downloadRequest);
//adding the csv to string array
string
[] strSeparators =
new
string
[] {
"\r\n"
};
string
[] Lines = response.Content.Split(strSeparators, StringSplitOptions.None);
//start sqlite insert
foreach
(var line
in
Lines.Skip(1))
Reply
Answers (
3
)
Cannot evaluate the exception stack trace
How to get google map using two cordinate