Variants.Unassigned

From Référence RAD Studio VCL
Jump to: navigation, search

Informations C++

De Variants.hpp

	System::Variant __fastcall Unassigned(void);


Unité : Variants

Type : fonction

Description

Renvoie un variant "vide".


Une variable variant peut être "vide", c'est-à-dire ne pas encore avoir été initialisée. La fonction Unassigned renvoie un variant vide, qui peut être affecté à une variable variant pour restaurer cette variable à son état initial.

Utilisez la fonction VarIsEmpty pour tester si un variant est vide. Appliquée à un variant vide, la fonction standard VarType renvoie varEmpty.

Si un variant vide est transtypé en un autre type (par exemple, par une affectation à une variable non variant ou en appelant VarAsType), les conversions suivantes sont effectuées :



Destination Résultat de conversion

Type numérique

Zéro

Type chaîne

Chaîne vide

Booléen

False.



Remarque :  Unassigned est utile avec des variants faisant référence à des objets OLE Automation, que vous voulez conserver "en vie" jusqu'à ce qu'une autre valeur soit affectée au variant.

Il y a une fonctionnalité correspondante sous Linux. A documenter ultérieurement.

Voir aussi

Personal tools