LoginSignup
2
3

More than 5 years have passed since last update.

【C#】doubleをvolatileにする

Posted at

longdoublevolatile 修飾子をつけることはできない。
volatile が必要な場合、次のように Thread.VolatileRead および Thread.VolatileWrite を使う。

Sample.cs
double _Property;
public double Property
{
    get => Thread.VolatileRead(ref _Property);
    set => Thread.VolatileWrite(ref _Property, value);
}
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3