Logo

Programming-Idioms

History of Idiom 117 > diff from v33 to v34

Edit summary for version 34 by programming-idioms.org:
[Csharp] List class

Version 33

2017-05-27, 19:28:13

Version 34

2017-06-07, 14:00:08

Idiom #117 Get list size

Set n to the number of elements of list x.

Illustration

Idiom #117 Get list size

Set n to the number of elements of list x.

Illustration
Extra Keywords
length
Extra Keywords
length
Imports
System.Collections.Generic;
Imports
using System.Collections.Generic;
Code
int n = x.Count;
Code
int n = x.Count;
Comments bubble
If x is of type IEnumerable, use Count() instead.
Comments bubble
Work for a List object.

If x is of type IEnumerable, use Count() instead.
Doc URL
https://msdn.microsoft.com/en-us/library/27b47ht3%28v=vs.110%29.aspx
Doc URL
https://msdn.microsoft.com/en-us/library/27b47ht3%28v=vs.110%29.aspx