Adding an implicit cast functionality to Lazy<T> can give you an option to writing null checkers in your delayed instantiation properties. The problem Today in our project a colleague was cussing over the fact that he kept writing the same block of code over and over again when null checking a property with a backing [...]
Lazy<T> with implicit cast to T can give you some pretty code
August 9th, 2010 by Magnus Mårtensson — .Net, Tips & Tricks
Handling Lazy + Metadata instances in Managed Extensibility Framework (MEF)
August 4th, 2010 by Magnus Mårtensson — .Net, Architecture, Tips & Tricks
Have you ever wanted to dynamically choose from many potential implementations of some code? Would you like to have the power of metadata filtering and lazy instantiation of the selected implementation? Here is how to do just that using Managed Extensibility Framework (MEF) and also a neat trick to handle your implementation/metadata pairs that I [...]
Tags: .Net, .NET Framework, tips
Performing any Selector on the Main Thread
March 30th, 2010 by Fredrik Olsson — Cocoa, Embedded, Tips & Tricks
Many UI frameworks, including AppKit for Mac OS X and UIKit for iPhone OS, require that all methods to UI components are sent on the main UI thread. Cocoa and Cocoa Touch make this quite easy by providing for example -[NSObject performSelectorOnMainThread:withObject:waitUntilDone:] in Foundation. Making updating the text for a text field a snap: [someTextField [...]
Tags: cocoa touch, concurrency, iphone, mac, mobile, objective-c, open source, programming, tips, tutorial
