Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unexpected behavior (bug?) in collections and AMEMBERS
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00883536
Message ID:
00883553
Vues:
8
Hi Paul,

It's known problem. See Re: For Each rotation changes type in collection Thread #843966 Message #844014

>I've run into a weird situation with objects being added to a collection and using AMEMBERS with it. Here's some sample code which shows the problem:
>
>
>LOCAL loCollection
>?"-------------------"
>loCollection = CREATEOBJECT("Collection")
>loItem = CREATEOBJECT("Empty")
>ADDPROPERTY(loItem, "TestProp", "Test")
>?AMEMBERS(laTest, loItem)
>
>loCollection.Add(loItem)
>
>FOR EACH loCollItem IN loCollection
>    ? "This fails:"
>    ?AMEMBERS(laCollTest, loCollItem)
>    ?
>    ? "This works:"
>    ?loCollItem.TestProp
>    ?AMEMBERS(laCollTest, loCollItem)
>ENDFOR
>
>
>Basically, what I'm seeing is that until I actually access a property in the item in the collection, AMEMBERS doesn't see any of the properties. So, on the "This fails:" line I'm seeing a count of 0 (it should be 1), and once I access the property, it returns 1.
>
>What's up with this?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform