Partager via


Array.IsReadOnly Propriété

Définition

Obtient une valeur indiquant si l’objet Array est en lecture seule.

public:
 property bool IsReadOnly { bool get(); };
public:
 virtual property bool IsReadOnly { bool get(); };
public bool IsReadOnly { get; }
public virtual bool IsReadOnly { get; }
member this.IsReadOnly : bool
Public ReadOnly Property IsReadOnly As Boolean
Public Overridable ReadOnly Property IsReadOnly As Boolean

Valeur de propriété

Cette propriété est toujours false destinée à tous les tableaux.

Implémente

Remarques

Array implémente la IsReadOnly propriété, car elle est requise par l’interface System.Collections.IList . Un tableau en lecture seule n’autorise pas l’ajout, la suppression ou la modification d’éléments après la création du tableau.

Si vous avez besoin d’une collection en lecture seule, utilisez une System.Collections classe qui implémente l’interface System.Collections.IList .

Si vous effectuez un cast ou convertissez un tableau en objet IList d’interface, la IList.IsReadOnly propriété retourne false. Toutefois, si vous effectuez un cast ou convertissez un tableau en IList<T> interface, la IsReadOnly propriété retourne true.

La récupération de la valeur de cette propriété est une opération O(1).

S’applique à

Voir aussi