invalid typed array length code example
Example: non null array length
public static <T> int getLength(T[] arr){
int count = 0;
for(T el : arr)
if (el != null)
++count;
return count;
}
// equivalently in pure C# :
public static int getUsedLength(string[] arr)
{
int count = 0;
for (int i = 0; i < arr.Length; i++)
{
if (arr[i] != null)
{
++count;
}
}
return count;
}