Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
For Each rotation changes type in collection
Message
 
 
À
29/10/2003 06:16:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00843966
Message ID:
00844014
Vues:
18
It's known issues with collections. A FOR EACH loop uses COM interface to access items in a collection. It's recomended to use regular FOR ... ENFOR loop instead. For more details see FOR EACH Enumerations of VFP Collections Do Not Provide True Object References Bug #9


>When using a for each iteration with a collection, Date-type values get changed to Time-type as shown in the example below !!!
>
>LOCAL loColl, oColl, lnI
>STORE 0 TO lnI
>STORE null TO oColl, loColl
>
>loColl = NEWOBJECT("Collection")
>
>FOR lnI = 1 TO 10
> loColl.Add(DATE()-lnI)
>ENDFOR
>
>FOR EACH oColl IN loColl
> ? VARTYPE(oColl) &&& == Time Type !!!
>ENDFOR
>
>FOR lnI = 1 TO 10
> ? VARTYPE(loColl.item[lni]) &&& == Date Type which is correct !!!
>ENDFOR
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform