I'm trying to create a generic class which will have some static functions based on the type. Are there static members for each type? Or only where there is a generic used? The reason I ask is I want a lock object for each type, not one shared between them.
So if I had
class MyClass<T> where T:class
{
static object LockObj = new object();
static List<T> ObjList = new List<T>();
}
I understand that ObjList would definitely have a different object created for each generic type used, but would the LockObj be different between each generic instantiation (MyClass<RefTypeA>
and MyClass<RefTypeB>
) or the same?