What are the differences between Shared and Static?

前端 未结 2 1873
梦如初夏
梦如初夏 2021-01-11 10:15

I\'m a C# developer but I\'ve inherited a legacy VB app today with 0 documentation what so ever. I\'ve been starting to read through the code and reference the list of VB ke

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-11 10:57

    The equivalent of the C# Static method modifier is Shared in VB.net

    The closest equivalent of the C# Static class modifier in VB.Net is a Module

    The Static keyword in VB.NET defines a local variable that exists for the lifetime of the process. There is no equivalent of this in C#.

    For a great reference of comparison between the two see this link: https://www.harding.edu/fmccown/vbnet_csharp_comparison.html

提交回复
热议问题