开发者

is DataTable.FindBy() Threadsafe?

开发者 https://www.devze.com 2023-03-08 06:45 出处:网络
I have a DataSet with Multiple DataTables and i\'m retrieving rows from it with FindBy method. My application is Multi-Threaded, and my question is, is it thread safe or shoul\'d开发者_开发百科 i cove

I have a DataSet with Multiple DataTables and i'm retrieving rows from it with FindBy method. My application is Multi-Threaded, and my question is, is it thread safe or shoul'd开发者_开发百科 i cover all of my methods with a lock which will make my app not a Muli-Threaded app...


DataTable Class

Thread Safety

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

Source: MSDN

This should answer your question.


You shall protect any Create/Update/Delete operations with synch logic. For performance reasons do not synchronize Reads.

FindBy does not sound like it is modifying data. From the other hand as pointed by Matan

Selecting rows using Select method on DataTable (yes, this can modify the DataTable by creating a new index on it).

0

精彩评论

暂无评论...
验证码 换一张
取 消