c# - F11 debugs correctly but F5 does not -


I have a strange problem with some of my code; I have made a list of some items; When trying to fill this list with new items, if I use F5 , then all the members of the list will be created like each other!

But when I try to debug this problem with F11 , then members of the list will be separated from each other (which is correct). I am using a loop to generate all the members of the list, and in each iteration of the loop, I add the first class object using the new and then add it to the list I am

I define the list as follows:

  1. list & lt; MyClass & gt; Find out why F5 does not fill the list correctly I tried to repeat the same problem in other classes which contained only strings and integer members, but it works properly.

    The problem is that new random () method in each iteration of the loop Due to the use of this, the right way to do this is to use it for example

      rndNumber = new random ()   

    once out of the loop, and Then only use

      rndNumber.Next () in the loop; More information about the solution can be found in the following link: 


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -