I have seen a lot of questions asked about static methods being accessed by multiple threads and the thread-safety of them. I think I have got most of it down in terms of ensuring thread safety, but one thing I am not too sure about is when you introduction the 'ref' variable into the mix within the static method itself. Here is a cut down example:
public static string ProcessMessage(object msg)
{
string outcome = "";
Decrypt(ref msg);
// parse msg
return outcome;
}
private static void Decrypt(ref object msg)
{
// decrypt msg
}
Is the above example thread-safe? All the processing that takes place within the static methods uses locally declared variables, it's just the ref object that gets passed from one static method to another that I'm unsure about.