Mark,
The method that is executed doesn't have accessibility changed because
it is running in another thread. So if your thread method T is indeed on C,
then it should have access to all members of that instance of C (if it is an
instance method).
The reason this is dangerous is that if the method T is not the only
method accessing V (which it most likely isn't, otherwise it would be a
variable in the method itself), you need to synchronize access to it. The
easiest way to do this is through the lock statement.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Mark Huebner" <mh******@bostwicklaboratories.comwrote in message
news:uL**************@TK2MSFTNGP04.phx.gbl...
If I have a class C that contains a private variable (property) V and
private function T and T is executed within C as a separate thread, does
thread T have access to private variable (property) V in the instance of
class C? It appears to but another person has suggested that this is
dangerous and that global variables should be defined in a separate class
with the static type modifer.