Tag: Programming

Dot Net Gotcha #1 – List versus Collection constructor

Don’t Google it! Do you know (without Googling it) what will this console application display when executed? If you try to think logically, you expect that both List and Collection will contain numbers from 1 to 6 when they are displayed, right? Wrong, otherwise this would not be a proper gotcha 😉 Here is the actual output of the application (surprise, surprise): Do you know why? Answer is actually very simple. If you check the MSDN documentation for Collection constructor that accepts generic IList you will see this text: Initializes a new instance of the Collection class as a wrapper for…

Silverlight MergedDictionaries – using styles and resources from Class Libraries

If you were developing larger Silverlight/WPF applications and trying to keep things like styles, control templates and other resources organized it can become really hard. Prior to Silverlight 3 it was hell to be honest 😀 You had to scatter resources all around your application, on control level and put global ones in App.xaml and soon it would all grow beyond control. But then nice people from Microsoft introduced lovely little feature called MergedDictionaries that allows you to combine the resources from different places in your application. The beauty of this simple technique is that you can use resources from…