In this post, We will learn about the SortedList and SortedDictionary in C# using some code examples. Furthermore, we will compare these two collections in a tabular format which will help us to understand the fundamental difference between SortedList and SortedDictionary in C#.
By the end of this post, you should have a good understanding of when to use SortedList and when to use SortedDictionary in your code.
C# Tutorial
Learn C# programming language with this comprehensive C# tutorial series. From beginner to advanced topics, It covers everything you need to know to become proficient in C# programming.
Understanding the Difference between int, Int16, Int32, and Int64 in C#
C# provides several data types to store numerical values and it’s important to choose the right one. In this article, we will delve into the difference between int, Int16, Int32, and Int64 in C#. You will learn about the size, minimum, and maximum values for each data type and when it is appropriate to use them.
In C#, int
, Int32
, and Int64
are numeric data types capable of storing integer values. They differ in their range and memory usage.
The main difference between int, Int16, Int32, and Int64 in C# are as follows:Int16
variables can hold values ranging from -32,768 to 32,767,Int32
variables can hold values ranging from -2,147,483,648 to 2,147,483,647 andInt64
variables can store values ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Jump Statements in C# (Break, Continue, Goto, Return and Throw)
Jump statements allow you to control the flow of your program. They are also known as control transfer statements. There are several types of jump statements in C#, including break, continue, goto, return, and throw.
In this post, we will try to learn different types of jump statements available in C# with multiple examples. Additionally, we will discuss how and where to use them.
Is vs As operator in C#: Understanding the differences between is and as operator in C#
is vs as operator in c#:
In C#, the IS and AS operators are essential keywords used to determine the type of an object during runtime.
The IS operator checks the type of an object and returns a boolean
value, which is true if the object is of the same type and false if not. On the other hand, the AS operator not only checks the type of an object but also performs a type conversion if the object is compatible with the given type.
Abstract Factory Design Pattern in C#: Real-World Example and Code Explanations
The Abstract Factory Design Pattern is a creational design pattern that provides a way to create families of related or dependent objects without specifying their concrete classes. This blog post will explore the Abstract Factory Design Pattern in C#, using a real-world example and providing code explanations.
Singleton Design Pattern in C#: A Beginner’s Guide with Examples
In this article, We will explore the Singleton design pattern in C#, its use cases, and various ways to implement singleton class.
SOLID Design Principles in C#: A Complete Example
SOLID is a set of five design principles introduced by Robert C. Martin in 2000 to make code more maintainable, flexible, and scalable.
In this article, we will learn about five important SOLID principles and how they can be used with C# programming. We’ll also see practical examples to understand how to apply these principles in real-world situations.
SOLID Design Principles
SOLID is a widely recognized acronym that represents a set of five fundamental design principles in software development: the Single Responsibility Principle, Open-Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle.Â
C# dispose vs finalize – Understanding the difference between dispose and finalize in C#
Dispose() and Finalize() are crucial methods for releasing resources in C#. These methods are used to clean up resources, such as database connections and files that are no longer needed. However, there are some significant differences between the dispose and finalize methods in C#.
- The
IDisposable
interface defines the Dispose() method, while the Object class defines the Finalize() method. - Users can explicitly call the Dispose() method, whereas the Finalize() method is automatically called by the garbage collector (GC) before an object is destroyed.
C# Partial Class And Partial Methods With Examples
C# Partial classes and partial methods will allow you to split the implementation of a class or a method across multiple files. This can be useful when working with automatically generated code, as it allows you to make changes to the generated code without losing them when the code is regenerated.
The partial
keyword allows you to split the definition of a class, struct, interface, or method into multiple source(.cs) files. Each file contains a part of the definition, and all the parts are combined when the application is compiled.
This article will provide an overview of partial classes and partial methods in C#, including how and why they are implemented.
C# Struct with [Examples]
A C# Struct is a value type that represents a lightweight object. Unlike classes, which are stored on the heap, a struct is stored on the stack, making it more memory-efficient and faster to create and use.
Struct is a perfect choice for creating small, lightweight objects that hold value-type data and do not require inheritance.
C# Hashtable vs Dictionary vs HashSet
A Hashtable, Dictionary, and HashSet are all data structures that store and retrieve data based on keys. However, there are some important differences between them.
C# Hashtable with example – How to use and when to use?
In this blog post, we will take a deep dive into C# hashtables, explaining what they are, how they work, and how to use them effectively in our C# code.
We will also cover some common scenarios where hashtables can be particularly useful, as well as some tips and best practices for working with them. By the end of this post, you should have a solid understanding of hashtables and how to leverage their power in your C# projects.
Understanding C# Queue Class With Examples
C# Queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. In other words, the first element added to the queue will be the first one to be removed. This makes queues useful for storing data that needs to be processed in a specific order. The queue is the opposite of the Stack<T> collection.
In C#, the
Queue
class is a generic collection that implements theIEnumerable
interface and provides a variety of methods for adding, accessing, and removing elements in the queue.
C# Static Class, Methods, Constructors and Fields [with examples]
A static class is a class that cannot be instantiated and contains only static data members. It is a collection of utility or helper methods that can be called directly by the class name itself without creating an instance of the class.
C# Polymorphism: Different types of polymorphism in C# with examples
Polymorphism is a Greek word that means “many-shaped” or multiple forms of an object. You can use polymorphism in case you want to have multiple forms of one or more methods of a class with the same name.
Polymorphism is one of the main key concepts of object-oriented programming after encapsulation and inheritance.
In this article, we are going to learn about the different types of polymorphism in C#, how they work, how to implement them, and how to use polymorphism in our program code.
Params Keyword in C# With Examples
C# params are useful when you declare a method and don’t know how many arguments will be passed as parameters.
C# Stack Class With Push And Pop Examples
Stack in C# represents a last-in, first-out (LIFO) collection of objects. It is useful when you need last-in, first-out access to elements. Adding an element to the stack is called a push operation, and removing an element from the stack is called a pop operation.
A Stack is a collection that can be both generic and non-generic. The generic stack is defined in the System.Collections.Generic
namespace. A non-generic stack, on the other hand, is defined under System.Collections
namespace. In this post, we will discuss a non-generic type stack.
C# Tuple: How to work with a Tuples in C#?
A Tuple<T>
is a data structure that allows you to combine multiple elements of different data types into a single object.
It was first introduced with .NET Framework 4.0 and allowed a maximum of eight elements to be stored. Attempting to store more than eight elements will result in a compiler error.
This article will explore how to work with C# Tuples and demonstrate their usage with simple code examples.
C# Nullable types: How do you work with nullable types in C#?
As you know, a value type variable cannot be assigned a null value. For example, if you try to assign a null value to the value type int i = null it will give you a compile-time error.
In this post, you will learn about the C# Nullable Types with the help of multiple examples.
What Is Node.js and Why Should You Use It?
What Is Node.js?
Node.js is an open-source, cross-platform runtime environment and library for executing JavaScript code outside of a browser. It uses an event-driven, asynchronous, non-blocking I/O architecture, making it lightweight and efficient for data-intensive real-time applications running across distributed devices.
Node.js is neither a framework nor a programming language but a runtime environment. It was written and introduced by Ryan Dahl in 2009.
Node.js was built on top of chrome V8 JavaScript Engine that is written in C++ language. All the JavaScript code is executed by the V8 JavaScript engine; which converts the code into Assembly code, which is then converted into machine code. Machine code is something that a computer processor understands.