C# Programming/Keywords/volatile
The volatile
keyword is used to declare a variable that may change its value over time due to modification by an outside process, the system hardware, or another concurrently running thread.
You should use this modifier in your member variable declaration to ensure that whenever the value is read, you are always getting the most recent (up-to-date) value of the variable.
class MyClass
{
public volatile long systemclock;
}
C# Keywords | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Special C# Identifiers (Contextual Keywords) | |||||||||||||||
| |||||||||||||||
Contextual Keywords (Used in Queries) | |||||||||||||||
|
This keyword has been part of the C# programming language since .NET Framework 1.1 (Visual Studio 2003).