Nested Repeaters

Please see my other C# articles. Achieving multi-level reporting. Many business scenarios require reporting data to accurately model the world from which it came. For example in a typical sales meeting, decision are made on several types of data. Therefore, such reports must reflect a multi-level structure in order to illustrate key metrics. In this example, I…

Design Patterns: Singleton

Please see my other Design Pattern articles. Ensuring single instance use during instantiation. Every so often in development, a business rule dictates that instantiation of a certain type produce only one instance during the lifetime of the application. The Singleton design pattern, one of the Creational Patterns, ensures that regardless of many instantiations of a…

Design Patterns: Service Locator

Please see my other Design Pattern articles. Completing the IoC Design Pattern. In my Design Patterns: Inversion of Control article, I illustrated how to decouple classes from having dependencies – the CustomerPayment class contained a dependency on the IPayment interface. Any class which has intimate knowledge of another is tightly-coupled to that class. By implementing…

Design Patterns: Inversion of Control

Please see my other Design Pattern articles. Providing flexibility into the domain by abstracting implementation. Using abstraction between concrete and class implementation, avoid tightly-coupled classes, which leads to changes in once class to ripple throughout your application. One method of doing this is the Inversion of Control design pattern which allows the class calling the…

Design Patterns: Factory

Please see my other Design Pattern articles. Providing flexible object-instantiation. In this example, I’ll illustrate a method by which a SalesAssociate object may be instantiated that is more flexible than the traditional way – using a constructor. Instead I’ll implement a factory design pattern to create the instance. There are two advantages to this approach:…

Design Patterns: Adapter

Please see my other Design Pattern articles. Exposing class behavior from another class. Sometimes you might need to access and use functionality defined from one class from within your own class. To illustrate this pattern, I’ll begin with a simple class that contains one method I wish to invoke from within my other class –…

C#: String Operations

Please see my other C# articles. Performing common string operations. The .NET Framework is essential a huge repository of reusable classes that provide robust functionality organized by various namespaces. For example, the String namespace allows developers to easily and safely manipulate strings in a variety of ways. First, I’ll show I perform such basic string operations using…

C#: Type Inference

Please see my other C# articles. Writing flexible, elegant code for data storage. When writing business logic, it’s often difficult to determine at design-time what type an object will need to be or what type of data it will store. Thankfully, Microsoft has provided an elegant solution by allowing developers to write code that will store any…

C#: LINQ – Query

Please see my other LINQ articles. Performing a simple query. Using Microsoft’s new elegant syntax or subset of the .NET framework that looks like it might be replacing ADO.NET, I will illustrate how to perform a simple query. This new syntax is much less bulky than executing the same query using ADO.NET commands. First, I’ll begin by…

C#: Generics

Please see my other C# articles. Ensuring type-safety in objects. Whenever performing domain modeling, it’s critical to ensure code matches the real-world environment as much as possible. The chief method for doing so to utilize classes by which objects may be instantiated. However, having a collection of objects that are either the incorrect type or contain incorrect…