List, Dictionary, HashSet, IEnumerable, LINQ query and method syntax, deferred execution and lambda expressions.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What does List.Add() do?
Show answer
Adds an item to the end of the list
- How do you remove an element at a specific index from a List?
Show answer
Use RemoveAt(index)
- How do you access an element at index 3 in a List?
Show answer
Use list[3]
- What property gives the number of elements in a List?
Show answer
Count
- What does List.Clear() do?
Show answer
Removes all elements from the list
- What does List.Contains(item) return?
Show answer
Boolean indicating whether the item exists in the list
- How do you add a key-value pair to a Dictionary?
Show answer
Use Add(key, value) or dict[key] = value
- Can a Dictionary have duplicate keys?
Show answer
No, all keys must be unique
- What does Dictionary.ContainsKey(key) return?
Show answer
Boolean indicating whether the key exists in the dictionary
- What does Dictionary.TryGetValue(key, out value) do?
Show answer
Safely retrieves a value and returns bool indicating success
- How do you remove a key-value pair from a Dictionary?
Show answer
Use Remove(key)
- What do Dictionary.Keys and Dictionary.Values return?
Show answer
Collections of all keys and all values respectively
- What does HashSet<T> remove that a List<T> allows?
Show answer
Duplicate values
- What does HashSet.Add() return?
Show answer
Boolean, true if added, false if element already existed
- What is the time complexity of HashSet.Contains()?
Show answer
O(1) average case