Android Question Help - I'm confused

Robert Valentino

Well-Known Member
Licensed User
I was getting some strange results and I came across one of the problems.

I have the following Pseudo code:

  Type  TDB_Scoring_Player(RecordID As Long, GridRow As Int, ScoreCardName As String, Handicap As Int)

  Dim PlayingPlayers as int
  Dim Players          as List '  NOTE:  This is a list of TDB_Scoring_Player types filled in by somewhere else

   For PlayingPlayers = 0 To Players.Size-1     
         Dim  Player  As TDB_Scoring_Player = Players.Get(PlayingPlayers)  ' thought I was getting a copy

         Do While Player.Handicap > 0
               '----------------------------------------- Alot of other code not shown
              Player.Handicap = Player.Handicap - 1          '  Changed this value
I thought by Dimming a Player structure inside the for Loop and doing the get would have me working on a copy of the Player which I now know is not tru

When I change the Player.Handicap in then Player Handicap loop not only is it changing the copy of Player but it is also changing the copy inside the Players List.

So it appears that the is really NO reason for a Set after I do the Get? Because I am actually working on the real player?

Player = Players.Get

do something then

Normally I would do a

Players.Set(x, Player)

But that is not needed?

Robert Valentino

Well-Known Member
Licensed User
Thanks for the clarification

Normally I would do

Dim Player As TDB_Scoring_Player = Players.Get(PlayingPlayers)

'--------- Change some of the Player fields

Players.Set(PlayingPlayers, Player)    ' Save back in list  *** NO longer needed because working with real
But because I am getting the Real Player and not a copy the Set is not needed (does it save anything by not doing it?)
Last edited: