Click here to Skip to main content
12,303,190 members (76,080 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
When we use static keyword in c#.net?
Why we use static keyword in c#.net?

what is the keyword used in vb.net for static in c#.net ?

Is any feature not available for static among vb.net and c#.net ?
Posted 29-Apr-11 2:05am
Comments
Sandeep Mewara 29-Apr-11 8:16am
   
:doh: Google?
Rajesh Puli 29-Apr-11 8:25am
   
No Effort
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

See here: What is "static" in C#?[^].

See here for the Static analogon in VB[^].

Best Regards,

-MRB
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hello,

The static keyword defines, that the class / property / method you declare as static does not require an previous instance of a object. In the other hand, a static method for example cannot use any instance method / instance property of the own object.

Also static defined things will be optimized by the compiler, for example that a static object is only written once in the memory and everything accesses to the same object.

Here you get perhaps more detailed informations about the static keyword:
http://msdn.microsoft.com/en-us/library/98f28cdx.aspx[^]

Also a google search would help:
http://www.google.com/[^]

I'm sorry about not answering the VB Questions, but I'm not a VB specialist and do not know how this is solved in VB.NET. Perhaps google have some more answers.

Hope this helps.

Best regards and have a nice weekend,
Stops
  Permalink  
Comments
Manfred R. Bihy 29-Apr-11 8:32am
   
Yes OP should have been able to find the complete solution by himself, but what the heck!
5+
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Static keyword C#[^]

static vb.net[^]

Wasn't that simple. Do search before you ask.

PS - the answer will move your question out of the unanswered list.
  Permalink  
Comments
Manfred R. Bihy 29-Apr-11 8:31am
   
Quite easy I'd say! 5+
Ankur\m/ 29-Apr-11 8:38am
   
Thanks and to you too!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

This article might be a good help:

Static Keyword Demystified[^]

The keyword in VB.net to do the same thing is

Shared

Tim
  Permalink  
Comments
Manfred R. Bihy 29-Apr-11 8:31am
   
Yup! 5+
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

Hello...

when we use static key word it means there is no need to create an instance of object . static class including a static method can called
by class name.
note that static class can have only static methods
  Permalink  
Comments
Afzaal Ahmad Zeeshan 1-Apr-15 23:43pm
   
That is wrong answer, it is not the meaning of static keyword or its usage.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

  Permalink  
Comments
CHill60 2-Apr-15 11:22am
   
Please do not resurrect old questions simply to post a link to your own article. It is abuse of the site. The question was adequately answered over 3 years ago. Anyone searching CP for this is likely to come across your article before this question so this was a pointless action
Priyank Modi 2-Apr-15 11:47am
   
What wrong with that? it is answering the question that was asked long before but why you think that this question can only be to the person who asked this question. In fact I came to question while i was doing research on my article only. There may be people coming to this article after long. They may have come with same question or may be with more details on same subject. And why do I write 1 or 2 statement to answer where i have described in details with diagram.

With due respect, I don't see a strong point in your comments. Even I don't see the harm to put link to my own article and i will continue to. Ultimately we spend our crucial time to write article to share knowledge with people. In fact, I feel such comments can be demotivating. if code project thinks that now this can not be answer anymore, why don't code project freeze the post.

CHill60 2-Apr-15 11:51am
   
CP doesn't freeze posts, that's the SO site behaviour.
As I explained - anyone searching CP on the subject should come across your article any way so there is no point in just duplicating answers.
Continue to post links to your own articles to old questions if you like - but don't be surprised if your answers start attracting downvotes from other members [Edit - I've just noticed that it has actually started - none of those down-votes were from me by the way]
Priyank Modi 2-Apr-15 11:58am
   
It's individual decision to up or down. No one has control to it. I don't feel demotivated If someone justify down vote, It will help me improve my contribution and that way i will learn too. As contributor, we have to keep contributing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160530.1 | Last Updated 1 Apr 2015
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100