VB.NET Shared

  • Thread starter Thread starter Dean
  • Start date Start date
D

Dean

Hi,

what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

thanks,
Mori
 
Dean said:
what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

I believe so, yes - but I have a pretty limited grasp of VB.NET.
Basically static means that the field (or property, or method) doesn't
apply to a specific instance of the type, it applies to the type as a
whole.
 
Dean said:
Hi,

what is the C# equivalent of VB.NET's Shared

e.g.

in VB.NET
Public Shared myColor As Color

does static do the same job?

public static Color myColor;

thanks,
Mori

Yes.
 
Hi!

Yes, "static" is the equivalent for VB.NET's "shared" keyword.
 
Back
Top