Do I have to use concurrent types in MethodTwo
.
if I don't, can my list (anotherList
) is completely saved with true values?
public void MethodOne(List<int> idList)
{
foreach (int id in IdList)
{
var Item = GetById(id);
System.Threading.Tasks.Task.Run(() => MethodTwo(item.PropOne));
}
}
public void MethodTwo(int prop)
{
List<string> anotherList = new List<string>();
anotherList.Add("AAA");
if (prop>20)
anotherList.Add("BBB");
else
anotherList.Add("CCC");
//some other operations
SaveList(anotherList);
}
There is a bug but I can not catch it. I am suspicious about this method. I tried load test on this method and I could not get any information.