list.add seems to be adding a reference to the original object?

后端 未结 2 608
遥遥无期
遥遥无期 2020-12-10 16:01

I have created a couple custom classes (NTDropDown and NTBaseFreight) which I use to store data that I retrieve from a DB. I initialize a List of <

2条回答
  •  忘掉有多难
    2020-12-10 16:58

    tempDropDown is the same object throughout the whole loop. You will need to create a new instance of it if you want to add more than one.

    I'm having a hard time trying to figure out what exactly your'e trying to do with adding that tempDropDown the the list.

提交回复
热议问题