use of shared variable in vb.net

Jak
Jak
Member
858 Points
132 Posts

Hi,

use of shared variable in vb.net

Views: 10803
Total Answered: 1
Total Marked As Answer: 1
Posted On: 31-Mar-2015 16:39

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
Editor
1382 Points
14 Posts
         

Hi Rahul,

Shared variable Specifies that one or more declared programming elements are associated with a class or structure at large, and not with a specific instance of the class or structure.

It is same as static in C#.

Sharing a member of a class or structure makes it available to every instance where each instance keeps its own copy.
This is useful, if the value of a variable applies to the entire application.

Example:

Public Class shareTotal
Public Shared total As Integer
End Class
Posted On: 31-Mar-2015 19:37
 Log In to Chat