The primary purpose of using volatile in C# is for multi-threading writes against a field.
csharp
public static class SomeClass
{
public static long Id;
}
For performance reasons a processor can cache values it is reading into a register. As long as there are no writes then it is safe to cache into a register. However if the field is changed by another thread then the cached value is out of date. You can use a memory buffer to prevent this but that is generally only useful when your code is actually doing the writing. If you're just reading the value then using a memory buffer would effectively prevent a value from being cached and thus impact performance.
The volatile keyword tells the runtime that it is possible for the value to be written in a thread other than the current thread and thus limits what optimizations that are done. It is a tradeoff between performance and safety.
In general you should avoid using writable fields to begin with. This eliminates the need for volatile. You can learn more about volatile in the discussion of .NET memory model.