Is a static member variable common for all C# generic instantiations?

后端 未结 4 2022
半阙折子戏
半阙折子戏 2020-12-11 15:11

In C# I have a generic class:

public class MyGeneric where ParameterClass: MyGenericParameterClass, new() {
    public static int Varia         


        
4条回答
  •  时光取名叫无心
    2020-12-11 15:47

    No, it is not shared.

    Each MyGeneric class will resolve to a different runtime type, for each possibility of T.

    Please check that there is no non-generic MyGeneric class with the Variable static member.

提交回复
热议问题