Is it possible to create a non-fixed size array in C#?

1.3k Views Asked by At

When creating an array like with

string[] list = new string[5]; 

There is a variable named IsFixedSize. So is it possible to create an array that is not fixed size? The only way I know is by using List<string>. I am confused because I thought arrays are about being fixed size, so why is there a list.IsFixedSize?

1

There are 1 best solutions below

0
On BEST ANSWER

No, all arrays are fixed in size. If you read the docs on the property though, it explains why:

Property Value

Type: System.Boolean

This property is always true for all arrays.

And:

Array implements the IsFixedSize property because it is required by the System.Collections.IList interface