The following code explains my question. I know the list is not thread safe. But what is the underlying "real" reason of this?
class Program { static void Main(string[] args) { List<string> strCol = new List<string>(); for (int i = 0; i < 10; i++) { int id = i; Task.Factory.StartNew(() => { AddElements(strCol); }).ContinueWith((t) => { WriteCount(strCol, id.ToString()); }); } Console.ReadLine(); } private static void WriteCount(List<string> strCol, string id) { Console.WriteLine(string.Format("Task {0} is done. Count: {1}. Thread ID: {2}", id, strCol.Count, Thread.CurrentThread.ManagedThreadId)); } private static void AddElements(List<string> strCol) { for (int i = 0; i < 20000; i++) { strCol.Add(i.ToString()); } } }