Get the length of an Array C#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Zerrtor

I cannot find how to get the Length of an array for Godot. I’ve tried Length, Count(), and Size() and they all bring different errors.

Length gives
Operator ‘>’ cannot be applied to operands of type ‘method group’ and ‘int’

Size gives
‘Array’ does not contain a definition for ‘Size’ and no accessible extension method ‘Size’ accepting a first argument of type ‘Array’ could be found (are you missing a using directive or an assembly reference?)

Count gives
There is no argument given that corresponds to the required formal parameter ‘what’ of ‘StringExtensions.Count(string, string, bool, int, int)’

Here’s the code.

using Godot;
using System;

public class SoftCollision : Area2D

	bool IsColliding(){
		var areas = GetOverlappingAreas();
		return areas.Length > 0;
:bust_in_silhouette: Reply From: jgodfrey

I’m not a Godot C# user (I use gdscript), but I am a C# coder in general.

I’d expect a C# array to have a Length property, but looking at the Godot C# docs, it seems it has a Count property instead.

Note, that’s a property, not a method (so, areas.Count, not areas.Count())