Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
1.33/5 (6 votes)
See more:
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
Comments
Sandeep Mewara 29-Apr-11 8:16am    
:doh: Google?
Rajesh Anuhya 29-Apr-11 8:25am    
No Effort

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

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

Best Regards,

-MRB
 
Share this answer
 
v2
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
 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Apr-11 8:32am    
Yes OP should have been able to find the complete solution by himself, but what the heck!
5+
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.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Apr-11 8:31am    
Quite easy I'd say! 5+
Ankur\m/ 29-Apr-11 8:38am    
Thanks and to you too!
This article might be a good help:

Static Keyword Demystified[^]

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

Shared


Tim
 
Share this answer
 
Comments
Manfred Rudolf Bihy 29-Apr-11 8:31am    
Yup! 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
 
Share this answer
 
Comments
Afzaal Ahmad Zeeshan 1-Apr-15 23:43pm    
That is wrong answer, it is not the meaning of static keyword or its usage.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900