c# - DataRowCollection 线程安全吗?

标签 c# .net multithreading ado.net thread-safety

我想在多线程环境中将行添加到 Table.Rows 集合中。例如:

DataTable dt = CreateDataTable(...);
Parallel.For(0, 100, (i, loopState)=>{
    DataRow row = GetRow(...);
    dt.Rows.Add(row);
});

那么,Tables.Rows 线程安全吗?

最佳答案

来自MSDN :

This type is safe for multithreaded read operations.You must synchronize any write operations.

关于c# - DataRowCollection 线程安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35984329/

相关文章:

.net - .MAUI : How to add context menu into control by using community-toolkit-markup or C#

c# - 在 ASP.net Core 中注入(inject)多个 ServiceBusClient

multithreading - 什么时候或为什么我应该使用 Mutex 而不是 RwLock?

C# 到 C#,方便的语言特性

c# - 将元组列表转换为字符串的更好方法

.net - 优化 vba 宏 excel 2007 的循环

python Pool result.get() block 信号处理程序

multithreading - 使用boost的SSL asio代码,async_write_some挂起

c# - GDI+ 中的非缩放笔

c# - 使用 LINQ-to-SQL 从事务内部回滚存储过程调用?