Skip to main content

Posts

Showing posts with the label .NET Core

C Sharp (C#) data structures

In C#, data structures are used to store and manipulate data efficiently. C# provides several built-in data structures and allows us to create custom data structures using classes and structs. Some of the commonly used data structures in C# include: 1. Arrays: Arrays are fixed-size collections of elements of the same data type. They provide efficient random access to elements. Example: int[] numbers = new int[5]; numbers[0] = 10; 2. Lists: Lists are dynamic arrays that can grow or shrink in size. They are part of the System.Collections.Generic namespace. Example: List<int> numbersList = new List<int>(); numbersList.Add(10); 3. Queues and Stacks: These are collections used to manage data in a first-in-first-out (FIFO) or last-in-first-out (LIFO) manner, respectively. They are also part of the System.Collections.Generic namespace. Example: Queue<int> queue = new Queue<int>(); Stack