Category: .NET/C#

  • Direct Casting, IS and AS Operator in C#

    Hello friends, Below are the available ways in C# when you cast one data type to another. Direct casting Direct cast is most common way of casting one type to another, however it yields exception if casting can’t be done. Below is the example to demonstrate the same. object length = 3.2; int test = (int)length; //Fails in…

  • Changing default route in ASP.NET MVC

    Hello friends, As we know that ASP.NET MVC by default takes following setting available in RouteConfig file (under App_Start folder). routes.MapRoute( name: “Default”, url: “{controller}/{action}/{id}”, defaults: new { controller = “Home”, action = “Index”, id = UrlParameter.Optional } ); This means when you run the application, Home controller will be invoked and it’s Index method will be executed by taking parameter id (if any). you can change…

  • Working With Async Main In C# 7.1

    Hello folks! I am here to present the series related to C# 7.1’s new features. In the first part, we will be going through one of the important features called async main. async main Starting with C# 7.1, the main function that is the entry point of the application can have async. Before C# 7.1,…

  • Threads Inception in .NET

    Hello guys, Threading in .Net is an important topic. I have seen people unable to understand the nuances of processes, threads and how they are related in .Net and also in general. In the series of articles around threading, I will try to present the concepts in the simplest way possible so that it can…