Removing n elements from array starting from index This method removes n elements starting from a given index, from an array of a given type. If n is positive it removes elements forwards, if it is negative it removes them backwards (e.g. for an array {1,2,3,4,5} Remove(2,2) results in {1,2,5}; Remove (2,-2) results in {1,4,5})

It there a better way to do it?

public static class ArrayExtensions
{
    public static T[] RemoveAt&lt;T&gt;(this T[] array, int idx, int len)
    {
        T[] newArray;

        if (len &gt; 0)
        {
            if (idx + len &gt; array.Length)
                len = array.Length - idx;

            newArray = new T[array.Length - len];
            if (idx &gt; 0)
                Array.Copy(array, 0, newArray, 0, idx);

            if (idx &lt; array.Length - 1)
                Array.Copy(array, idx + len, newArray, idx, array.Length - idx - len);
        }
        else
        {
            newArray = new T[array.Length + len];
            if (idx &gt; 0)
                Array.Copy(array, 0, newArray, 0, idx + len);

            if (idx &lt; array.Length - 1)
                Array.Copy(array, idx, newArray, idx + len, array.Length - idx);
        }            

        return newArray;
    }
}
I believe that if the len &lt; 0, it's better to adjust idx and len values. This will eliminate two branches of code.

Another suggestion is to use more readable variable names.
For instance, method arguments could be named startIndex and length respectively.

public static T[] RemoveAt&lt;T&gt;(this T[] array, int startIndex, int length)
{
    if (array == null)
        throw new ArgumentNullException("array");

    if (length &lt; 0)
    {
        startIndex += 1 + length;
        length = -length;
    }

    if (startIndex &lt; 0)
        throw new ArgumentOutOfRangeException("startIndex");
    if (startIndex + length &gt; array.Length)
        throw new ArgumentOutOfRangeException("length");

    T[] newArray = new T[array.Length - length];

    Array.Copy(array, 0, newArray, 0, startIndex);
    Array.Copy(array, startIndex + length, newArray, startIndex, array.Length - startIndex - length);

    return newArray;
}