made ThreadStaticActivator util (a static generic class that creates ThreadStatic instances)

This commit is contained in:
John Colvin committed 2019-03-28 13:38:20 -05:00
1 parent 247a41de23
commit eef792d148
1 file changed
+9
@@ -0,0 +1,9 @@
using System;
namespace bts.utils {
static class ThreadStaticActivator<T> where T : class, new() {
[ThreadStatic]
static T _instance;
public static T instance => _instance ?? (_instance = new T());
}
}