Logo

Programming-Idioms

History of Idiom 165 > diff from v42 to v43

Edit summary for version 43 by BjorksElbow:
[Csharp] More idiomatic/safe

Version 42

2019-09-09, 09:20:13

Version 43

2019-09-26, 15:11:43

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Code
var x = items[items.Count - 1];
Code
var x = items.LastOrDefault();