A customer had the requirement to develop his solution with .NET 3.0 framework. I was already used to the new and nice features of .NET 3.5 framework, especially the class extension feature. A simple example for a class extension would be like this: public class ReverseString { public static void Main() { string s = "Hello World!" ; string r = s.Reverse(); } } static class StringHelpers { public static string Reverse( this string s) { char [] c = s.ToCharArray(); Array.Reverse(c); return new string (c); } } In order to use the same feature under .NET 3.0 you can use the following trick: First create an empty class file (e.g. AttributeExtension.cs) and add this class to your project. Secondly put the following code in that class: using System; namespace System.Runtime.CompilerServices { /// <summary> /// Indicates that a method is an extension method, /// or that a class or assembly contains ex
Bringing code to life is a developer's daily task to fulfill.