I have an c# application which owns 2 threads. One thread is creating an object while the same object is being used in the second thread. Most of the time it works fine but some time it gives and error Object is in use currently elsewhere.
How to make it possible for threads to use object at same time?
Thanks
Edit
I am accessing a Bitmap
object. One thread is creating this bitmap from a stream, displaying it on PictureBox
and the second thread is again converting this Bitmap
to Byte
and transmitting it on the network.