Another Generics problem

I want a static class to operate on builtin arrays… I have this so far, which works:

public static class Arr {

	// Reverse a builtin array of Vector3's
	public static Vector3[] Reverse ( Vector3[] a ) {
		
		Vector3[] b = new Vector3[a.Length];
		for (int c=0;c<a.Length;c++) {
			b
=a[a.Length-1-c];
    		}
    		return b;
    	}
    }

This is activated by using the code:

    existingVector3Array = Arr.Reverse( existingVector3Array );

However I want to use generics. I've tried:

    public static class Arr<ARR> {
    
    	// Reverse a builtin array
    	public static ARR[] Reverse ( ARR[] a ) {
    		
    		ARR[] b = new ARR[a.Length];
    		for (int c=0;c<a.Length;c++) {
    			b[c]=a[a.Length-1-c];
    		}
    		return b;
    	}
    	
    }

But I get the compile error:

***'Arr[of ARR]' requires '1' arguments.***

Well, since you are using C#, you can use the IEnumerable system with extension methods to do this.

public static class ArrTools
{
     public static IEnumerable<T> ReverseCustom<T> (this IEnumerable<T> arr)
     {
         for (int i = arr.Count() - 1; i >= 0; i--)
         {
             yield return arr.ElementAt(i);
         }
     }
}

Edit: demo code:

int[] testArr= new int[] {0,1,2,3,4};
foreach (int i in testArr.ReverseCustom())
{
	Debug.Log(i);
}

Personally, I would just use generic lists instead of arrays. Anyway, try using Object as the data type for your array and not ARR.