Alex Rivera | Logout

Is there an attribute to mark the class or method to be thread safe in .NET?

Asked 2009-03-18T12:58:54.763
11

In .NET how can I know if a class or method is thread safe or not? Is it by default not thread safe?

Edit
Report

1 Answer

-1

There is no use case scenario of making a class synchronized, as far as method is concerned you use following coding style:

using System.Runtime.CompilerServices;
[MethodImpl(MethodImplOptions.Synchronized)]   
void MyMethod()   
{   
DoSomething();   
}  
answered 2009-03-18T13:13:35.663

Your Answer