public void DoClassification() { if (SingleThreaded) { var cnt = 0; foreach (var post in Records) { Process(++cnt, post); } } else { Parallel.ForEach( GetNextPost(), () => new Classify(this), (line, state, cnt, partial) => partial.Process(cnt, line), partial => { lock (_obj) { Scores.AddRange(partial.Scores); Sad.Merge(partial.Sad); } }); } }
public void SectionRead(string fileName, int fileId, BindingList <int> listName) { string text = File.ReadAllText(fileName); string[] lines = text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); scorelist[fileId] = new int[lines.Length]; for (int i = 0; i < lines.Length; i++) { scorelist[fileId][i] = int.Parse(lines[i]); listName.Add(scorelist[fileId][i]); } Scores.AddRange(scorelist[fileId]); }