Some interesting things I learned over last month

This is a lazy blog 🙂 I have been very busy lately and learned a lot along the way as well. I wanted to write some blogs about parallel programming and Lazy loading, but time constrains still I am unable to do it. Rather than waiting long for me to write, I thought I post couple of links I used to learn and use them in the projects.

Lazy Loading:

In most of the cases, when you are doing lot of lazy loading, you will end up writing code which checks for null or default value and if it is in its initial state then you perform actual load. In C# 4.0, now we have some thing called Lazy<T> which help resolve this repetition. But if you would use it, then extracting value is little different than just calling the property getter. Rather than using property getter, you would use .Value to get the value.

Concurrent Collection items:

My current project is using parallel programming model, using PTL and PLinq. That by itself is a different blog, but if you are using any kind of parallel programming, you have to double check on how are you using the collections. Please do not use traditional collection if the data source is used across all threads. Instead use the concurrent collections specified in the System.Collection.Concurrent name space.