Why am I getting CS0119 using a static method in a template?
c#
Solution
The C# compiler does not support the invocation of static methods off of type parameters.
Note that there is no value in doing this here. The call to `IsIt` must be emitted when `CanIt` is compiled. There is no way of invoking a static method in a virtual dispatch manner A static method can only be invoked by referring to the type + method directly. Hence the only thing the compiler could do here would be to emit a call to `Foo::IsIt`. So why not just call `Foo::IsIt` directly?
Problem
Why does this (contrived) example give "error CS0119: 'T' is a 'type parameter', which is not valid in this context". Surely I have told it that the type will have a suitable method? ``` abstract class Foo { static public bool IsIt() {return true;} } class Bar { public bool CanIt<T>() where T : Foo { return T.IsIt(); } } ``` The actual motivating example is something more complicated involving CRTP in the template parameter, but this shows the problem.