Skip to main content

Posts

Showing posts from May, 2017

Possible Multiple Enumeration of IEnumerable

If you have worked with IEnumerable and using ReSharper , then you may land up into this warning, " Possible Multiple Enumeration of IEnumerable ". So, what this warning is all about? Well, before proceeding further, let’s see how we can store something into IEnumerable object . IEnumerable items = GetAllItems() So, above code itself speaks that items is a variable of type IEnumerable which will hold some values/objects we can iterate through. Now here lies the performance hit, which is also indicated in the form of ReSharper warning. This performance hit may not be significant for a small number of items. But this can be noticed while dealing with a huge number of items. Reason behind this is, whenever you are iterating through items collection, GetAllItems method will be called for the same number of times. Solution : It is always good to materialized the result in a list or array like below: IEnumerable items = GetAllItems().ToList() Once you are done w

.Net Architecture Guidance announced

Few days back, Microsoft announced the draft version of the .NET architecture guidance. This guidance is the combined effort of the Visual Studio team and the Microsoft Developer Division. As of today, it covers only 4 areas: ASP.NET Web applications Azure Cloud Deployment Xamarin Mobile Applications MicroServices and Docker You can find more about this guidance on Microsoft's documentation.