Pooling Buffers for Better Memory Management

Occasionally, you need a more robust solution to solve a problem. In my last post, I wrote about the horrors of this small code snippet: One way to alleviate the memory pressure that can be caused by frequent creation and destruction of large objects is to tell the .Net garbage collector to compact the Large…

Hey, Who Stole All My Memory?

Sometimes a little piece of seemingly innocuous code can cause a significant amount of trouble: Doesn’t look like much, but I’m sure we have all written something like this and paid it no mind. In fact, most of the time, code like this isn’t a problem. This little method becomes a problem when that object…

Coroutines for Asynchronous Sequential Workflows using Reactive Extensions (Rx)

I’ve been doing quite a bit with Reactive Extensions (Rx) for Silverlight lately. One idea that I keep exploring is the concept of creative intuitive sequential workflows for asynchronous operations. You can read about my explorations using Wintellect’s own Power Threading Library in this post along with a simple solution using an interface and enumerators…

Entity Framework: Expressing the Missing LINQ

I have worked on quite a few projects that use the Entity Framework. It is a powerful ORM and does quite a lot out of the box. I’ve worked with code-first, database-first, and every other flavor in between. If I were to name the one reason I believe developers enjoy working with LINQ the most,…

Reflection, Lambda, and Expression Magic

Sometimes I love how a little reflection can work magic. In this case I was building what I’ll call a “non-intrusive” validation system. The project contains entities that are generated by templates, and it would be extremely difficult to crack open those templates to put in a lot of custom validation code. So I decided…

A Fluent Backwards Design

Fluent interfaces make code easier to read, understand, and use. They can also provide a layer of separation and decoupling to make it easier to reuse components in a straightforward fashion. In this post I will walk through the scenario of creating a fluent interface with a “backwards design.” This means I’ll start with the…

Parsing the Visual Tree with LINQ

I noticed a project on CodePlex that provides a “JQuery-like syntax” for parsing XAML. It looked interesting, but then I wondered why it would be needed when we have such powerful features available to us in the existing runtime. Silverlight provides a powerful VisualTreeHelper for iterating elements in the visual tree. It also provides a…

Autofocus Nested Textboxes with Rx in Silverlight

The Problem A common UI pattern is to expose text in a read-only container, then swap it for an editable input box based on a command. There are multiple approaches to doing this (including just changing the style of the same container). Swapping between a read-only TextBlock to a TextBox is easy enough, but what…

Using Reactive Extensions (Rx) to Simplify Asynchronous Tests

Reactive Extensions (Rx) is a product from Microsoft Research that simplifies the management and composition of asynchronous events. If you read my earlier post on Asynchronous Workflows, you’ll understand why the asynchronous programming model can sometimes lead to confusing and hard-to-maintain code. There is nothing wrong with the model, but the fact that you must…