Category Archives: .Net

Finally, .NET got JSON API

Dealing with JSON data is a pretty standard use case in modern application development and .NET applications are no exception. When compared to XML data type which apparently has built-in support with lot of libraries and interfaces in .NET Framework. Remember, LINQ to XML which gives in-memory LINQ query interface over XML data source. Strangely,… Read More »

Visual Studio 2019 is here!!

Microsoft has announced the first preview of Visual Studio 2019 back in December 2018. Now, Microsoft has announced the general availability of Visual Studio 2019 for Windows and Mac. You can download latest IDE with lot of interesting features from here and others details on Visual Studio 2019 timeline from here Visual Studio Features Microsoft… Read More »

4. C# tip – Always return Task or Task <T> for Async methods

C# offers two key words Async and await to provide simplified asynchronous programming model in .net framework to easily write asynchronous code using concise syntax. It is based on Task based asynchronous pattern. The core of async programming are Task and Task<T> objects, which model asynchronous operations. We can pattern Task based asynchronous code mostly for following two use… Read More »

3. C# tip – Named tuples (C# 7 feature)

C# methods usually a single object or value. To return multiple values, we usually resort to creating a class or use struct to carry multiple elements. Unfortunately, it’s more work to create and maintain those classes which simply exist to return multiple values with no value addition in domain model and obscure class design principles.… Read More »

2. C# tip – Useful ASP.Net classes,utilities providing HTTP request context (Url info)

ASP.Net developers are all too familiar with System.Web namespace. This assembly pretty much holds all of ASP.Net together. While we are interested in understanding incoming HTTP requests thrown at our website or webapp, we spent a lot of time around HttpContext or HttpRequest classes which encapsulate HTTP request raw values into typed object properties giving us… Read More »

1. C# tip – Use is operator and as operator

In C#, type casting is so common and important thing.  C# allows to cast between types in multiple ways. As shown below, simple and most common way to do casting in C# which poor programmers tend to use is direct cast which anyways, ends badly.  Direct cast indicates speculative code. Avoid such vulnerable coding at… Read More »

Generate multi checkbox list in asp.net mvc

Unfortunately, there is no built-in Html helper or Tag Helper which can render multi-checkbox list in asp.net mvc. Following syntax is old school I get it :-). I must have authored a Tag Helper extension. Any ways, this code snippet conveys the point rather in a traditional way