Can't create static variable inside a static method?

前端 未结 4 1154
夕颜
夕颜 2021-01-24 23:44

Why won\'t this work?

public static int[] GetListOfAllDaysForMonths()
{
    static int[] MonthDays = new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-01-25 00:38

    What would be the scope of that static variable declared within the method? I don't think CLR supports method static variables, does it?

提交回复
热议问题