Maximum number of variables in method

后端 未结 2 794
面向向阳花
面向向阳花 2021-01-11 23:21

I was here idle, so I had this curiosity, Someone can tell me what\'s the maximum number of variables per method in C#?

2条回答
  •  旧巷少年郎
    2021-01-12 00:06

    I just tried to compile a generated program source with 26*26*26*26 local variables, not method parameters, (they were called @aaaa, @aaab, @aaac and so on), and I hit this limitation:

    error CS0204: Only 65534 locals are allowed

提交回复
热议问题