Building a component that works with different versions of a library

It’s common to want to build a .NET component that works with different versions of a particular library. It is also common for newer versions of the library to introduce new methods that your component might want to call. However, if you build your component against the oldest version of the library you support, then…

A Fluent RSS Reader for Silverlight Part 1: Proof of Concept

One of the most common examples to help learn a language or framework is an RSS Reader. This is an ideal mini-project because it includes networking, parsing XML, and binding to data elements such as lists. I wanted to provide an example that shows some more interesting solutions that are possible using C# in Silverlight.…

Auto-Discoverable Views using Fluent PRISM in Silverlight

One reason a developer would use a technology like MEF is to, as the name implies, make an application extensible through a process called discovery. Discovery is simply a method for locating classes, types, or other resources in an assembly. MEF uses the Export tag to flag items for discovery, and the composition process then…

ASP.Net Dynamic Data (LINQ) Tips and Tricks

Dynamic data is a technology that enables RAD (rapid application development) for data-driven applications. What is a data-driven application, or rather, when does it make sense to use ASP.NET Dynamic Data? Any type of CRUD (create/read/update/delete) application is a prime candidate for dynamic-driven applications. In fact, if you are building an internal site simply to…

Silverlight Communication: Three Ways to Connect

Silverlight has myriad ways to connect to other systems and retrieve information for your applications. It is a common question people ask (“How do I get my data from the database to Silverlight?”) and each method has its own pros and cons. The purpose of this project, “Silverlight Communicator,” is to provide a simple, easy…

A Twist on the Observer Pattern

The observer pattern is well established and used. The typical scenario is to register to an class and then allow your Notify method to be called. This often involves keeping an internal list of observers and then iterating them to notify that something has changed. I had a situation recently that warranted a lighter weight…

More Confusion over “by ref” versus “Reference Types”

Apparently my prior blog post about “by ref” versus “reference type” caused quite a stir and a bit of confusion. I think the underlying issue is that people confuse “by ref” as having something to do with “reference types.” They are not the same. Reference types and value types are about instances, passing by ref…

What’s in Your Collection? Part 3 of 3: Custom Collections

This is the last installment in a three part series about using collections in C#. The entire series can be accessed here: Part 1: Interfaces Part 2: Concrete Part 3: Custom Collections We’ve now covered the interfaces and some concrete instances of collections provided by the .NET Framework. Now you are interested in moving things…

What’s in Your Collection? Part 2 of 3: Concrete

The collection is a powerful construct that allows a developer to logically group related elements and navigate through them. In this article, we’ll explore some concrete implementations of collections that are part of the base .NET framework. The entire series can be accessed here: Part 1: Interfaces Part 2: Concrete Part 3: Custom Collections (If…

Ref Keyword for Reference Types

The Ref keyword is well known. It indicates that you are passing a reference, not a value, to a method. That means that if the method modifies the value, the changes will be apparent to the calling method as well. Where I see a lot of confusion, however, is what happens when dealing with reference…

Pragmatic Reflection on Singletons

So today I was wading through some code that gets called quite a bit. It is in a process that might be hit thousands of times per second. It uses a pipeline pattern so there are several objects to “new up” and place in the pipeline. Being performance-minded I originally was tempted to follow the…

Lambda Expressions, Anonymous Methods, and Syntactic Sugar

What is the relationship between lambda expressions, anonymous methods, and delegates? The answer is, in two words: syntactic sugar … or is it? To show this, I put together a real simple console program that declares a delegate which returns a string. I then declare a concrete method that matches the delegate signature, and another…