Extension methods missing from System.String in the .NET Framework 3.5 (Beta 1)

UPDATE: Extension methods

Extension methods are a feature of the new C# language specification (also available in Visual Basic [^] [^]):

This new feature should be used in existing classes like the String class by making the folowing methods extension methods:

public static int Compare(this string strA, string strB);

public static int Compare(this string strA, string strB, bool ignoreCase);

public static int Compare(this string strA, string strB, System.StringComparison comparisonType);

public static int Compare(this string strA, string strB, bool ignoreCase, System.Globalization.CultureInfo culture);

public static int Compare(this string strA, int indexA, string strB, int indexB, int length);

public static int Compare(this string strA, int indexA, string strB, int indexB, int length, bool ignoreCase);

public static int Compare(this string strA, int indexA, string strB, int indexB, int length, System.StringComparison comparisonType);

public static int Compare(this string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, System.Globalization.CultureInfo culture);

public static int CompareOrdinal(this string strA, string strB);

public static int CompareOrdinal(this string strA, int indexA, string strB, int indexB, int length);

public static string Concat(this string str0, string str1);

public static string Concat(this string str0, string str1, string str2);

public static string Concat(this string str0, string str1, string str2, string str3);

public static string Copy(this string str);

public static string Intern(this string str);

public static string IsInterned(this string str);

public static bool IsNullOrEmpty(this string value);

This would allow us to write code like this:

if (someString.IsNullOrEmpty())

{

    //…

}

If you would like to see this in the next release of the .NET framework, vote on this suggestion.

This entry was posted in 2666, 2671, 2672, 2673, 2675, 2676, 2677. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>