In defense of lock(this) and GC.Collect()

I really dislike it when ill-informed people write blogs, articles, and even books about things they know really nothing about.  In the C# world, there a couple of topics that are the subject of literally thousands of ill-informed blog and forum posts, for which the real, correct advice is buried and lost in the noise and chatter of supposed “experts” offering words of “wisdom” to newbies out there.  The couple of topics that I see come up again that I find particularly upsetting are whether or not it is okay to ever call “lock(this)”, and whether or not, and how-often, anyone should call “GC.Collect()”. Continue reading “In defense of lock(this) and GC.Collect()”