public static (const) in a generic .NET class
问题 Is there a syntax trick to get to the constant in a generic class without specifying an (ad-hoc) type? public class MyClass<T>{ public const string MyConstant = "fortytwo"; } // I try to avoid this type specification. var doeswork = MyClass<object>.MyConstant; // Syntax similar to what I'd like to accomplish. var doesnotwork = MyClass.MyConstant; There is a caveat about the static variable (constant) not being shared between different types like MyClass<object> and MyClass<int> but my