Extension methods – how they look like after compiling

This blog entry is supposed to be the continuation for entry C# Extension Methods where I told what extension methods are and how to use them. This time I will tell about what they are behind the curtains. Do they really add new methods to current classes or not? I mean, are these methods really added to classes or are they something else?

How to connect Business Data Catalog (BDC) lists to other SharePoint lists

Recently I had to create Web Part connection between BDC based list and usual SharePoint list. BDC list was provider and usual SharePoint list was consumer. I was pretty surprised if found out that I was able to connect BDC based list only to other BDC based Web Parts. All the other Web Parts were not able to be consumers for them. Same time BDC lists were able to be consumers of the other web parts.

C# extension methods

One of new cool features that will be available in C# 3.0 are extension methods. Extension methods will allow us to extend existing classes with new functionality. In this example I will show you how to extend System.string with two methods that are very popular in PHP: nl2br() and md5().

C# automatic properties

C# 3.0 makes it very convenient to create properties that doesn’t carry any functionalities besides returning value of attribute and assigning value to it. This new feature is called automatic properties.

Testing sorting algorithms

Some time ago I had to deal with sorting algorithms. Besides my main task I found a good way how to test custom sorting algorithms. This blog entry is one of early birds, more about sorting algorihtms is coming soon. Hopefully some time after TechEd 2007 for Developers. The procedure I wrote to test sorting algorithms is simple and works. Of course, I am always opened for better ideas if somebody wants to suggest some. Here’s the little overview about what I’ve done.

How to create grayscale images on .NET

In this example we will use simple color recalculation method to grayscale images. For each pixel on image we will calculate “average color” that we write back on image. Average color is sum of current color’s red, green and blue channels integer value divided by three. This value is assigned to all three channels for current pixel.

SQL-DMO and searching from meta-data

Lately I faced the need to search for specified strings in all stored procedures in given database. I found SQL-DMO library very useful for it. So, ten minutes later I had a simple form that fits my needs perfectly. And some minutes later I had there some more cool features. As a result I had form that enables me to search for strings from stored procedures, user defined functions and views.


At the end of the previous month I wrote a posting on DefensiveDatasource class that can be used to associate ASP.NET’s GridView with collections containing objects of different types and based on one and the same base class. Dividing data into pages in GridView does, however, not succeed. An error message “The data source does not support server-side data paging” is displayed.

Creating simple tasks calendar for SharePoint sidebar

I needed view of SharePoint calendar where I can see not accomplished activities from beginning of calendar until tomorrow. If you ask me why I needed something like this, there is a simple answer: this calendar contains almost everything that is going on (mainly different milestones and deadlines).

Filtering SharePoint calendar by Start Time

I had a problem when trying to filter WSS 3.0 calendar list by Start Time column. This column doesn’t appear in filtered columns list somewhy. I found solution that smells like dirty hack to me, but at least it solved my problem.


We recently implemented some changes in the software development methodology used at our company and quite by chance encountered an interesting .Net 2.0 problem. Namely, when an object array inherited from the same base class is cast on a base class and submitted to the data binder, the latter gets confused. The array contained objects from different classes but all these classes had one and the same base class.

.Net and Deep Copy

Some time ago I had to clone objects and .Net’s shallow copy proved to be insufficient – it was necessary to use deep copy. No good tools are provided by .Net itself. If required, the object to be cloned must conform to the ICloneable interface and the Clone() method can be defined for the object. As the classes were not very numerous, but relatively bulky and complicated, there was no point in writing a Clone() method for all of them. I needed something else.

ASP.NET and Hierarchical Data

In addition to other new and interesting things ASP.NET also brought along controllers supporting representation of hierarchical data. This posting introduces IHierarchyData and IHierarchyEnumerable interfaces we can use to create wrappers for classes representing hierarchical data of the business logic layer.

Using WCF Services with PHP

I recently wrote two postings on the subject of WCF services: WCF Services – Let’s Get Started and WCF and Unit Tests. One could see that creating and testing services was not complicated at all. Let’s go on and take some steps nearer to the real world – our service is used by SOAP clients running on different platforms.

Exporting GridView Data to Excel

My current project required a way for exporting data to Excel. I could of course write a separate export method for every data set but in my opinion it would be a pointless waste of time. I would also like to utilise the existing functionality as much as possible – as it is, the lists going to Excel are displayed to the user in the browser.

WCF and Unit Tests

Good practices demand tests for every new thing you have been able to get running. Otherwise our TDD chief is glum and moody during smoke breaks. So, to maintain the ever cheerful and busy climate in our office, this posting is going to discuss testing.

WCF Services – Let’s Get Started

In connection with testing WCF services I had to get the services to work under IIS on my development computer. The default WCF services library created by Visual Studio does not automatically include IIS support. There were other small glitches that I was able to overcome nicely, in spite of everything.