Hi,
how i can find the last element of arraylist.
bhagawatshinde
11
Posting Whiz
Recommended Answers
Jump to PostArrayList is an ordered collection of objects so last element must be Count-1.
ArrayList a = new ArrayList() { 11,22,33,44,55,77 }; object last=a[a.Count - 1]; List<int> b = new List<int>() { 11,22,33,44,55,66,77 }; int lastele=b.Last();
All 3 Replies
Ayan0788
0
Newbie Poster
Akill10
commented:
That is not an array list, also, 0 - 1 = -1...
+0
kvprajapati
1,826
Posting Genius
Team Colleague
bhagawatshinde
11
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.