I have a very old but very large library which I am considering converting to a C# class library. The existing library uses a lot of global variables stored in the TLS. C# h
You can achieve the same thread local storage using the [ThreadStatic]
attribute or in .Net 4 by using the ThreadLocal
class.
[ThreadStatic]
private static string MyThreadGlobal;
private ThreadLocal MyThreadGlobal = new ThreadLocal();
There's also the CallContext class but the other approaches are probably preferred.