Is the order of elements on a C# List deterministic?

前端 未结 3 1125
[愿得一人]
[愿得一人] 2021-01-17 15:10

I\'ve always thought otherwise, but recently I had the need to know:

If I add elements to a list in a certain order, am I guaranteed to find then always on the same

3条回答
  •  心在旅途
    2021-01-17 15:51

    Yes, it is deterministic. Bear in mind that if you want to use List across threads then, as with anything, you can't guarantee the order in which the interactions would happen.

提交回复
热议问题