I'm using .Length() with an array but there's some problem?

Hi all,

I’m baffled by this:

childFragments.Length();

But it doesn’t work! It doesn’t even have .Length() as a supported function.

What gives??

My guess is that you’re more familiar with Java than C#, judging from this mistake (not Javascript, note).

C# supports properties, while Java does not. Properties are a neat language-level way of creating getters and setters without using separate functions for each.

This allows assignments like x += 4, where in Java, you would use: SetX(GetX()+4). Array Length is a read-only property in C#, and a getter method in Java. These are exactly the same semantically, but properties are implicit method calls, so do not use ().

childFragments.Length;

It’s not a function, it’s a variable :slight_smile: