What is a HashMap?
Teil des Abschnitts Logik & Ablauf der C#-Journey von Coddy — Lektion 46 von 66.
In C# wird das Äquivalent zu einem HashMap als Dictionary bezeichnet. Ein Dictionary ist eine Sammlung, die Schlüssel-Wert-Paare speichert und es ermöglicht, Werte schnell über ihre zugehörigen Schlüssel nachzuschlagen.
Lassen Sie uns die Grundlagen verstehen:
Ein Dictionary speichert Daten als Schlüssel-Wert-Paare
// Die Syntax ist Dictionary<KeyType, ValueType>
Dictionary<string, int> ages = new Dictionary<string, int>();Spickzettel
Ein Dictionary speichert Schlüssel-Wert-Paare und ermöglicht schnelle Abfragen per Schlüssel:
// Syntax: Dictionary<KeyType, ValueType>
Dictionary<string, int> ages = new Dictionary<string, int>();Probier es selbst
Diese Lektion enthält keine Programmieraufgabe.
Diese Lektion enthält ein kurzes Quiz. Starte die Lektion, um es zu beantworten und deinen Fortschritt zu speichern.
Alle Lektionen in Logik & Ablauf
1Multi-dimensional Arrays
2D Arrays BasicsDeclaring and Initializing 2DAccessing 2D Array ElementsNested Loops with 2D ArraysJagged ArraysCommon Matrix OperationsRecap - Multi-dimensional4Flow Control Techniques
Early ReturnsGuard ClausesJump Statements (goto)Break and ContinueFlatten Nested Conditionals7Logical Operators Advanced
Short-Circuit EvaluationConditional Logical OperatorsOperator PrecedenceRecap - Advanced Operators2Advanced Decision Making
Multiple ConditionsComplex Boolean LogicIf vs. Switch ComparisonNested Switch StatementsRecap - Advanced Decisions5Exception Handling
Try-Catch BasicsException TypesMultiple Catch BlocksWorking with FilesFinally BlockUsing vs. Try-FinallyCustom ExceptionsRecap - Error Handling3Loop Enhancements
Loop PerformanceIterating ComplexEach Loop TypeRefactoring LoopsRecap - Optimized Loops6Null Handling
Null Reference BasicsNullable Value TypesNull Checking PatternsDefensive ProgrammingRecap - Null Safety9HashMap Part 1
What is a HashMap?Declare a HashMapCheck If Key ExistsAccessing ValuesModifying DictionariesRecap - HashMap