Examples from Chapter 5 (Collections) of Programming C# 8.0 (O'Reilly).
- Example 1. Creating arrays
- Example 2. Accessing array elements
- Example 3. Convoluted array access
- Example 4. How not to modify an array with immutable elements
- Example 5. Modifying an array with immutable elements
- Example 6. Laborious array initialization
- Example 7. Array initializer syntax
- Example 8. Shorter array initializer syntax
- Example 9. Array initializer syntax with element type inference
- Example 10. Array as argument
- Example 11. Searching with IndexOf
- Example 12. Searching with FindIndex
- Example 13. Using a lambda with FindIndex
- Example 14. Finding multiple items with FindAll
- Example 15. Search performance and BinarySearch
- Example 16. Creating a jagged array
- Example 17. Rectangular arrays
- Example 18. A 2×3×5 cuboid “rectangular” array
- Example 21. IEnumerable<T> and IEnumerable
- Example 22. IEnumerator<T> and IEnumerator
- Example 23. IAsyncEnumerable<T> and IAsyncEnumerator<T>
- Example 24. ICollection<T>
- Example 25. IList<T>
- Example 26. Trying (and failing) to enlarge an array
- Example 27. A simple iterator
- Example 28. A very simple iterator
- Example 29. An infinite iterator
- Example 30. Implementing IEnumerable<T> by hand
- Example 31. Iterator argument validation
- Example 32. Accessing the last element of an array with an end-relative index
- Example 33. Getting a subrange of an array with the range operator
- Example 34. Some start-relative and end-relative Index values
- Example 35. End-relative indexing, and pre-Index equivalents
- Example 36. Various ranges
- Example 37. Getting a substring with a range
- Example 38. Getting a subrange of an ArraySegment<T> with the range operator
- Example 39. Getting a subrange of a Span<T> with the range operator
- Example 40. Minimally enabling Index
- Example 41. Minimally enabling Range
- Example 42. How range indexing expands