C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Return: You can see that the IsFixedSize, IsReadOnly, and IsSynchronized properties all return a constant boolean.
True, FalseAnd: These are defined in the Array type, which means all arrays will return these values.
So: There is really no point of ever calling IsFixedSize, IsReadOnly, or IsSynchronized on an array type variable.
BoolC# program that uses these properties
using System;
class Program
{
static void Main()
{
int[] array = new int[4];
Console.WriteLine(array.IsFixedSize);
Console.WriteLine(array.IsReadOnly);
Console.WriteLine(array.IsSynchronized);
}
}
Output
True
False
False
Implementation of properties: .NET Framework
public bool IsFixedSize
{
get
{
return true;
}
}
public bool IsReadOnly
{
get
{
return false;
}
}
public bool IsSynchronized
{
get
{
return false;
}
}
Therefore: If you have a variable reference of type IList or ICollection, these properties may be useful.
Tip: If you are dealing with one of the interfaces an array implements, they may be more useful.
Interface