Get Computer Name in C#

To fetch computer name using C# code, we may consider below methods: Method 1: The below Example fetches the computer name from the Environment variables using the static Environment class under the system namespace. OR Method 2: The below Example fetches the computer name from the local DNS using the static DNS class under the …

Get Computer Name in C# Read More »

AddTransient vs AddScoped vs AddSingleton

Dependency Injections (DI) are one of the principal concepts of ASP.NET core. It is a software design pattern that makes the code easily maintainable by reducing tight coupling and in turn allowing loose coupling between the various software components. Injecting these dependencies at run time instead of design time helps to reduce hard coded dependencies …

AddTransient vs AddScoped vs AddSingleton Read More »

Code First vs Database First vs Model First Approach – Using Entity Framework Core

Code First and Database First are 2 terms that you will come across quite often while working with object-relational mapping frameworks such as Entity Framework. You will often find the developers and designers divided in 2 categories, most of the coders usually favor Code First while DB designers mainly support Database First. Entity Framework can …

Code First vs Database First vs Model First Approach – Using Entity Framework Core Read More »

Different Ways to Iterate Dictionary in C#

Dictionary in C# is a collection of Key value pair under the System.Collections.Generic namespace. Dictionary is optimized for fetching and saving values with constant complexity- O(1)Let us quickly look at ways to iterate over a dictionary. Consider below dictionary Iterate Dictionary using Foreach loop Iterate Dictionary using ForEach Lambda We can dictionary using System.Collections.Generic ForEach …

Different Ways to Iterate Dictionary in C# Read More »

Sealed Keyword in C#

The “sealed” keyword in C# is used to apply limitations to classes, methods, properties, indexes or events. Now, what kind of limitations you may ask? Well, let’s find out. Purpose of ‘Sealed‘ This concept of sealing is many a time used to encapsulate the logic that needs to be reused throughout the application without any …

Sealed Keyword in C# Read More »