0

How can I assign 1 to the last element of an array?

I used Last(),but there were a lot of errors

26th Dec 2017, 5:04 PM
Ghost Ghost
Ghost Ghost - avatar
2 Antworten
+ 3
To get the last item of a collection use LastOrDefault() and Last() extension methods var lastItem = integerList.LastOrDefault(); OR var lastItem = integerList.Last(); Remeber to add using System.Linq;, or this method won't be available. may by using that your problem will solved
26th Dec 2017, 5:08 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
Thank you
26th Dec 2017, 5:14 PM
Ghost Ghost
Ghost Ghost - avatar