The String class is sealed, so you cannot inherit it. Extension methods are your best bet. They have the same sensation as instance methods without the cost of inheritance.
public static class Extensions { public static bool contains(this string source, bool ignoreCase) {... } } void Example { string str = "aoeeuAOEU"; if ( str.contains("a", true) ) { ... } }
You will need to use VS 2008 to use extension methods.
Jaredpar
source share