Is it possible to declare a local varaible as Volatile?
No, its not possible. The volatile keyword can only be applied to fields of a class or struct. Local variables cannot be declared volatile.
(According to MSDN) Volatile assures that the most up-to-date value is present in the field at all times. This keyword indicates that a field can be modified in the program by something such as the operating system, the hardware, or a concurrently executing thread.
Using the volatile modifier ensures that one thread retrieves the most up-to-date value written by another thread.
Read More..   [55 clicks]
Published under: C# Interview Questions and Answers · · · ·