C# 8.0 Features

C# 8.0 is available in .Net Core 3.0 & .Net Standard.

Using Declarations

Now we can use using as a declaration rather than as a block.

using var file = new System.IO.StreamWriter(“WriteLines2.txt”);

Here the variable file will be disposed after end of scope.

Static Local Functions

Static Local Functions can be created within a Method which will not consume any Instance variables.

int M()


int y = 5; int x = 7;

return Add(x, y);

static int Add(int left, int right) => left + right;


Default Interface Methods

We can add default methods in Interfaces.  This will help in later versions of Interfaces.

interface IDefaultInterface
     int GetAge()
         return 18;

New Switch Structure

public static RGBColor FromRainbow(Rainbow colorBand)

=> colorBand switch {

Rainbow.Red => new RGBColor(0xFF, 0x00, 0x00),

Rainbow.Orange => new RGBColor(0xFF, 0x7F, 0x00),

_ => throw new ArgumentException(message: “invalid enum value”, paramName: nameof(colorBand)), };

// Saves “case” statement




Multithreading vs. Asynchronous

Multithreading & Asynchronous Programming are both Concurrent Programming.

Multithreading Asynchronous
CPU-concurrency I/O-concurrency
Thread class (old way) async.. await syntax
Task class (new way)

Task Parallel Library

Task Synchronous Programming Model

Task Parallel Library

Task Parallel Library is the preferred way of using Threads in C# for CPU concurrency.


var task = Task.Run((Action)DoProcess);

Task Synchronous Programming Model




Azure VNET Connectivity Options

We can connect 2 VNET using following options:

  • VNET Peering
  • VPN Gateway

VNET Peering

VNET Peering is the best option as it gives fastest connectivity using the Microsoft backbone infrastructure using Private addresses.

There are 2 types of VNET Peering:

  • VNET Peering for same region connectivity
  • Global VNET Peering for different region connectivity

VPN Gateway

If you have one of the VNET in an On-Premise then you can choose the VPN Gateway option.  It also offers Encryption which could make a decision.

However VPN Gateway will be slower compared with Peering, More Configuration & More Setup Time overheads exists.


Description VNET Peering VPN Gateway
Easy Setup Yes No
Encryption No Yes
Cross-Region Support Yes Yes
Pricing Less More
Speed High Low
Bandwidth Limit No Yes
Public IP No Yes
On-Premise Support Complicated Yes



What are the Different Ways to connect from Azure to On-Premise SQL Server?

Here I would like to list down the different ways to connect from Azure to On-Premise SQL Server.


We can create a site-to-site VPN for connecting from Azure to On-Premise.  Here the VPN device on Azure takes care of transmitting the request to the On-Premise network.


Azure Data Factory

Azure Data Factory requires running an Integration Runtime service in the On-Premise machine to make the connectivity happen.  It also requires Outbound port opening from On-Premise machine if there is any Outbound connection required back to the Azure SQL.


Azure Hybrid Connections

Hybrid Connections are created within the App Service.



Azure Service Bus Relays

Relays create endpoints on the On-Premise application which can be accessed by the Outside World.

Link: https://www.c-sharpcorner.com/article/overview-of-azure-service-bus-relay/

Express Route

Express Route is a highly secured option as it creates a new connectivity other than Public Internet.


On-Premises Data Gateway

If you are using Logic Apps, Power BI then you can rely on On-Premise Data Gateway.  This involves installing the On-Premise Data Gateway on Azure & On-Premise too.




Depending on your Network Security guidelines choose the appropriate one.

How to Verify Custom Domain from GoDaddy.com in Azure Portal?

In this post we can see how to verify custom domain purchased from www.godaddy.com in Azure Portal.

Purchase Domain

You can visit www.godaddy.com to complete the domain purchase.

Azure Portal

You can open the Azure Portal > Azure Active Directory > Custom domain names blade as shown below.


Choose the Add custom domain option > Enter your name > Copy the following values.


Copy the values.


Now go to the www.godaddy.com website


Choose > Manage DNS from the Ellipssis


In the upcoming records page click the Add button.


In the appearing page choose TXT and enter the values from Azure Portal.


Now wait for 1 minute & Come back to Azure Portal & Click Verify


You will get it Verified!