linq.ElementAtOrDefault

Gets the element at a particular index from the array, returning null if the index is out of range

Overloads

  • Object ElementAtOrDefault (index)

Object ElementAtOrDefault (index)

Gets the element at a particular index from the array, returning null if the index is out of range

Example

var myArray = [1, 3, 4, 4, 4, 5];
//Returns 3
myArray.ElementAtOrDefault(1);

//Returns null
myArray.ElementAtOrDefault(42);

Last edited Sep 24, 2011 at 6:39 AM by mlorbetske, version 2

Comments

No comments yet.