Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How Do I
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00180248
Message ID:
00180548
Vues:
18
>>to all,
>>
>>if you use: if type('ObjectName.Name') == "C" like bob suggested you don't have to use the ISNULL function.
>>
>>I use this method in methods which must be as fast as possible.
>>
>Hi Walter,
>
>I don't mean to pick, but you don't need the double equal sign there since TYPE() only returns a single uppercase character. Further, even if the function returned "OO" for a different data type, TYPE('ObjectName') = "OO" where 'ObjectName' is an object that would return "O", would evaluate to false. If you reversed the order ("OO" = TYPE('ObjectName') in these circumstance, then there would be a problem. Lastly, there might be some additional overhead in resolving the property reference. Whether or not this is as great as the multiple functions, I don't know.

George-

Right you are. I have seen the == used in many places before when checking the type of a variable or property.

The reason for this, as I have heard it explained is maybe esoteric but nonetheless valid in theory:

right now, VFP only returns single character data types, but we can't speak for the future. Future versions of VFP might allow data types of more than one character, or allow us to define structures with complete names.

I believe it was Ken Levy that put this forward as a reason to always use the == when getting a variables type.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform