Why do it this way

  • Thread starter Thread starter Alexander Muylaert
  • Start date Start date
A

Alexander Muylaert

Hi

when browsing thrue someone's code, I noticed the following lock mechanism.

Why would someone do it that way?

public class..
private readonly object _Lock = new object();

public int Count {

get {

lock(_Lock) {

return _List.Count;

}

}

Why not just

Lock(this){
return _List.Count;
}
Can somebody give me a clue?

Kind regards



Alexander
 
Back
Top