Ha! Having posted the question, I found the answer! Instead of searching in C #, I had to find information on how VB.Net implements it, and typing the question that seems obvious to me. After applying this understanding, I found the following:
http://weblogs.asp.net/psteele/articles/7717.aspx
This article explains that this is not supported by the CLR, and the VB compiler creates a static (generic) variable "under the hood" in the method class. To do the same in C #, I have to create a variable myself.
Moreover, it uses the Monitor class to ensure that the static member is also thread safe. Nice.
As a side note: I expect to see this in C # soon. The general tactic that I observed from MS is that VB.Net and C # do not like too far apart. If one language has a function that is not supported by another, it usually becomes a priority for the language command for the next version.
Joel Coehoorn
source share