C# static vs instance methods

后端 未结 8 726
再見小時候
再見小時候 2020-12-05 18:10

I\'m risking it this might be a newb question but here goes. I\'m tempted to add a method to a class that could possible have thousands and thousands of instances in memory

8条回答
  •  天涯浪人
    2020-12-05 18:43

    It doesn't make a difference, methods (static or instance) are only loaded once into memory and JIted, they don't consume more memory just because they are instance methods.

提交回复
热议问题