When to use 'var' as a Type?

(6 mins read)

Series: General

It has been quite a long time since var was introduced, yet it stands debatable among .Net developers. Everyone has a different understanding as and when to use var as a type. A couple of days ago I was also a part of one such discussion, and so I decided to share my understanding.

Code reusability has always been one of the major concerns for software developers. You do not ever want to write a similar code for two business problems. You would rather like to write the solution once and reuse it whenever and wherever required.

This is the second article in the series. We are going to set up a Microsoft Azure DevOps build pipeline to automate the tasks we did manually in the first article of the series. Each time we push a change to the master branch, the build will be triggered to build our application, then build a Docker image and push it to Docker Hub.

If you have been following along, you should have:

This article is the first in the series where we are going to build a simple ASP .Net Core web application, containerize it with Docker and run it on local host. And we will push everything to GitHub for later use.

In the posts to follow, we will setup Microsoft Azure DevOps Build pipeline to automate the process of building and pushing the Docker image to Docker Hub. Next, we will use Azure DevOps Release pipeline to deploy our application on Azure Web App Service as a container.