Elevated access for dotnet commands

Image by Arek Socha from PixabayFor best practices, software should have the least amount of privileges. However, some tools like performance monitoring require elevated admin permissions.The article describes the scenario for programming such software or applications in .Net Core.Install tool GloballyThe following instructions guide the way to run, install, or uninstall .Net Core tools that need to be executed … Continue reading Elevated access for dotnet commands

Intro to Property Pattern — C# 8.0

C# CONCEPTSMicrosoft has launched a property pattern in C# 8.0 version, which is an excellent way to compare object properties.PrerequisitesPlease understand the new switch syntax introduced in C# 8.0, which helps to understand the current article example much better.Getting StartedThe property pattern permits you to match on properties of the object measured.Single property classpublic class Calculate{public … Continue reading Intro to Property Pattern — C# 8.0

New Switch syntax with C# 8.0

C# CONCEPTSMicrosoft has launched newer syntax for switch expression starting from C# 8.0. Switch statements must produce a value in each of its case blocks. Switch expressions allow us to use extra compact expression syntax.With new syntax are fewer repetitive “cases and break” keywords and fewer “curly braces.”As an example, consider the following enum with … Continue reading New Switch syntax with C# 8.0

Progress with String Interpolation

C# PROGRAMMINGThe article demonstrates how to use string interpolation with more advanced formatting. This article emphasizes on more advanced scenarios where string interpolation is very helpful.Custom Date Formatting: To control the representation of dates, numbers, and other numeric values using custom formats. Whereas in Standard Formatting, use predefined formats.The syntax for formatting{ expression : formatting }Example: … Continue reading Progress with String Interpolation

What is Generics in C#

C# PROGRAMMINGGenerics allows you to define placeholders for fields, methods, parameters, etc. It replaces the placeholder with some specific type at compile time.Simple Generic In ActionSimple example of generic classBelow examples shows how to apply generics across class definition, variables, constructor, member functions & property.As you can see below TestGenericClass is declared with “<T>” where <> defines … Continue reading What is Generics in C#

Multiple Generic Constraints .Net

In this article, we will learn how to apply constraints with generics.Generic Constraints In ActionConsole GIF of generics constraintsGetting StartedIn above link, we have learned about generics. Consider below example of simple generic type in which compiler does not know about placeholder type whether its a class or a interface etc.https://gist.github.com/ssukhpinder/0e3d92e33922615e2b14dcc41e328fd6To overcome that, we apply … Continue reading Multiple Generic Constraints .Net