1/17
Flashcards covering basic data structures and collections in C#, including Lists, Dictionaries, Stacks, and Queues.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Collections
Specialized classes designed to effectively store, manage, and manipulate groups of objects, offering flexibility and advanced functionality compared to traditional data storage methods like basic arrays.
Arrays
Data structures that have a fixed size and do not allow dynamic resizing, which limits their flexibility in handling varying amounts of data.
System.Collections
A namespace in .NET that contains collections that are not generic, meaning they store items as base object types and require explicit casting when retrieving items.
System.Collections.Generic
A namespace in .NET that provides generic collections, utilizing type parameters (denoted as <T>) to ensure type safety, which leads to enhanced performance and error prevention.
Type-safe
A defining characteristic of generic collections which allows for type verification at compile-time by the C# compiler, thereby minimizing runtime errors such as InvalidCastException.
Boxing and Unboxing
Performance-intensive operations that convert value types to reference types and vice versa; these are mitigated through the use of generic collections, resulting in better efficiency.
List
A dynamic, strongly-typed generic collection that allows storage of a variable number of objects that can be accessed via their index and automatically resizes itself as needed.
Dictionary
A key-value pair collection that is strongly typed, where each key must be unique serving as an index for fast data retrieval, thus managing data efficiently.
Fast Lookup
An inherent feature of a Dictionary that allows for near-instantaneous retrieval of values using keys, typically operating in constant time, O(1), which greatly surpasses the speed of linear search methods.
ContainsKey()
A method that checks for the presence of a specific key within a Dictionary; this technique ensures that attempts to access a value associated with that key are valid.
TryGetValue()
A method that safely retrieves a value from a Dictionary without generating a KeyNotFoundException if the key does not exist, thereby enhancing code reliability.
Stack
A type of collection that organizes its elements in a Last-In, First-Out (LIFO) manner, making the most recently added element the first to be removed.
Push(T item)
An operation that adds a new object to the top of a Stack
Pop()
An operation that removes and returns the object at the top of a Stack
Queue
A collection that maintains its items in a First-In, First-Out (FIFO) sequence, ensuring that the first element added is the first to be removed.
Enqueue(T item)
A method used to add an element to the end of a Queue
Dequeue()
A method that removes and returns the element at the front of a Queue
Peek()
A method that retrieves the object at the top of a Stack