using System;
public static class ExtensionMethods
{
public static string Substring(this string s, int startIndex, int endIndex)
{
if (startIndex >= 0 && startIndex <= endIndex && endIndex < s.Length)
return s.Substring(startIndex, endIndex - startIndex);
else
return s;
}
}
public class Tester{
public static void Main()
{
string hello = "Hello";
Console.WriteLine("hello.Substring(2, 3) = {0}", hello.Substring(2, 3));
}
}