C# - static types cannot be used as type arguments

后端 未结 5 1300
北海茫月
北海茫月 2020-11-28 13:57

I\'ve a generic class, that helps me to do checks on argument values

internal sealed class Argument
    where T : class
{
    private void TraceAndT         


        
5条回答
  •  旧时难觅i
    2020-11-28 15:03

    Since static classes won't have instance members, my concern would be what kind of thing I'm going to do with them.

    I believe that, missing that you can't use static classes as generic arguments, I believe that you need to do this with extension methods instead of a generic class.

    https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/extension-methods

提交回复
热议问题