What's the best way to initialize shared members in a class in VB.NET?

前端 未结 1 1720
星月不相逢
星月不相逢 2021-01-17 15:18

I was looking on the Internet to see if there were any good examples on how to initialize shared members within a class while still initializing instance variables. I did fi

相关标签:
1条回答
  • 2021-01-17 16:01

    Shared Sub New (also known as a type constructor) is executed only once for each type (within an AppDomain, that is), so any member initialization in there will not be be repeated for each instance.

    0 讨论(0)
提交回复
热议问题