Lire en anglais

Partager via


Lazy<T>.Value Propriété

Définition

Obtient la valeur initialisée tardivement de l’instance de Lazy<T> active.

C#
public T Value { get; }

Valeur de propriété

T

Valeur initialisée tardivement de l’instance de Lazy<T> active.

Exceptions

L’instance Lazy<T> est initialisée pour utiliser le constructeur sans paramètre du type initialisé tardivement, et les autorisations pour accéder au constructeur sont manquantes.

L’instance Lazy<T> est initialisée pour utiliser le constructeur sans paramètre du type initialisé tardivement, et ce type n’a pas de constructeur public sans paramètre.

La fonction d’initialisation essaie d’accéder à Value sur cette instance.

Remarques

Si la Lazy<T>.IsValueCreated propriété est false, l’accès à la Value propriété force l’initialisation.

Outre les exceptions répertoriées, la Value propriété peut lever n’importe quelle exception non gérée levée par la méthode d’usine qui a été passée au valueFactory paramètre du Lazy<T>(Func<T>)constructeur, Lazy<T>(Func<T>, LazyThreadSafetyMode)ou Lazy<T>(Func<T>, Boolean) du constructeur.

S’applique à

Produit Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0

Voir aussi