Lazy loading is a common design pattern often used for constructing resource-intensive objects. It's also frequently used in conjunction with the singleton, and/or factory patterns. Lazy loading entails constructing an object at the point it's needed, rather than when it's declared. If the object never ends up being used, it will never be fully constructed. In versions of Microsoft's .NET Framework prior to 4.0, one would have to create their own lazy loading logic to take advantage of this pattern. Fortunately, .NET 4.0 includes Lazy<T>, which is a generic implementation of the lazy loading pattern. Let's first look at how to use Lazy<T> to implement the singleton pattern. The singleton pattern creates just one instance ever for an object; and it's often used for constructing objects that utilize scare resources.
In recent years, dependency injection (DI) and inversion of control (IOC) have gained popularity as means for creating and retrieving instances of classes in applications and libraries. This article examines these mechanisms, using MVVM Light’s SimpleIoc to illustrate the usefulness of implementing an IOC container in MVVM-based applications.
Generics are often introduced as the mainstream language feature of Whidbey (.NET2). However, while surfing off the beaten path I realized that new features named anonymous methods and iterators are also very interesting. Unlike generics, these two features don't imply new IL instructions set changes compared to .NET1 IL instructions set or any CTS changes. All the magic is in the compilers.
Generics are an extension of the CLR type system that allow developers to define types for which certain details are left unspecified. These details are specified when the code is referenced by consumer code, making for enhanced flexibility. This article explains how.
Jeremy Miller explains how internal Domain Specific Languages can help you craft code that is easier to read and write. His bag of tricks to improve your programming includes extension methods, fluent interfaces, object extensions and use of the semantic model.
This article shows you how to combine the two languages to serve the same .NET application. You get the best of both worlds: Python and .NET work together to provide reusable code functionality without your having to rewrite the code base for a single environment.
It is rarely cost-effective or feasible to manually port or rewrite code from one language into another. Java is a popular language for building applications for Unix*, while Microsoft has developed .NET and the Common Language Runtime (CLR)* for building cross-language applications under Windows*. Java and the CLR use different executable formats, which makes it challenging to build applications that need to integrate existing compiled Java class files into a .NET solution. Java class files can be integrated into the .NET CLR using the JbImp.exe utility (a command-line tool included in Microsoft Visual J#*). This paper shows how to use to JbImp.exe to convert working sets of Java .class files into .NET executables and .NET assemblies.