Dreaddan Dreaddan - 1 year ago 62
C# Question

Can you stop memory from being swapped to disk?

I was wondering if it was possible to prevent memory of a object (class or struct) from being swapped to disk?

Edit: As for why I've been told some of the data I'm going to be working with cannot be written to disk.

I dont expect it to be left long enough for the data to be swapped out but thought it's worth checking.

Answer Source

You might be looking for the SecureString class, which will not be swapped to disk.