C# and VB.Net keyword

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

VB.Net has the "static" keyword who allow me to declare a local variable
static like in C.
Is there any equivalence with C# ?
Thanks for your help.

Joël
 
Replace it with a class-level variable, but be aware that this new variable
will have to be declared 'static' (no relation to VB 'static') if the method
containing the original variable was a Shared ('static' in C#) method.

i.e., local static variables in static methods convert to class-level static
variables in C# and local static variables in non-static methods convert to
class-level non-static variables in C#.

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter
 
Thanks all for your responses.
But it's strange MS forgot to put this option in C#...

Joël
 
Jo?l said:
Thanks all for your responses.
But it's strange MS forgot to put this option in C#...

"Forgot" implies that it wasn't a deliberate omission, which I believe
it was.

Objects encapsulate state, as do types. Methods don't logically have
state. If a method has enough state, you should be considering
encapsulating it separately.
 
Really ? I never thought they forgot it. It's just provocation. ;-)
Unfortunatly, even after reading the FAQ, I continuing to think unbelievable
they have decided to not support it.
 
Back
Top