So, this question asks how to threadsave lists. To sum it up, instead of using
List<int[]> listName = new List<int[]>();
//you use:
SynchronizedCollection<int[]> listName = new SynchronizedCollection<int[]>();
But my problem is, that if I use:
int[] returnArray = new int[listName[0].Length];
I can't access those elements with indexing. How can I access them then? Is there not a way to make lists threadsafe without loosing any functionality?
Maybe I can work with limited functionality, I only need 4 things: reading the lowest and the highest elements (only those), deleting listName[0] and adding something on top. So I don't need any of the elements in the middle actually. But there are 2 threads and depending on what the thread did it will either add a new one on top and take it or delete the lowest one and take the new lowest one.
I can't use queues or stacks because of this, so I am all out of ideas.
Now the question is, is there something that fills those requirements?