Assigning null to the locked object?

  • Thread starter Thread starter Ympostor
  • Start date Start date
Y

Ympostor

Can I do this or it will give problems?:

lock(this.myObject){
this.myObject.Dispose();
this.myObject = null;
}

Regards,

Andrés

--
 
Can I do this or it will give problems?:

lock(this.myObject){
this.myObject.Dispose();
this.myObject = null;

}

It will be fine - but personally I prefer to lock on a variable which
isn't used for anything else.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top