</>
Skip to content
C# lessons (34/34)

C# — Collections

List

List<int> nums = new List<int> { 1, 2, 3 };
nums.Add(4);

Dictionary

Dictionary<string, int> ages = new();
ages["Alice"] = 25;

Queue/Stack

Queue<string> queue = new();
queue.Enqueue("first");

Stack<string> stack = new();
stack.Push("first");

Mini Practice

  1. Use List
  2. Use Dictionary
  3. Practice Queue/Stack
  4. Iterate collections

Up Next

Continue with Reflection - Runtime inspection.

Related Topics

Frequently Asked Questions about Collections

What is Collections in C#?

Collections is a fundamental concept in C#. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Collections?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Collections.

Why is Collections important in C#?

Collections is essential for C# development. Understanding this concept will help you write better code and solve real-world problems more effectively.