Question is shared function or not?

hugoguan

Member
Joined
Mar 31, 2011
Messages
5
Programming Experience
Beginner
hi all, i new to program in vb.net. i just wonder that how can we know what function in some class in vb.net is shared function or not. what is a good way to know it? or we need to remember all it by ourselves? help me!!! thanks!!!!!!!!!!!!
 
  • Reading the documentation, for example in String Methods (System) you can see shared methods is marked with a "S", in specific topics like String.Copy Method (System) you can see the declaration includes the Shared keyword. In usage examples you can also see things like 'String.Copy' and 'instance.Contains'.
  • With Object Browser, you can see the declaration when you select a member.
  • When coding, intellisense dropdown displays the declaration for selected member in a tooltip.
  • When inspecting existing code, you can mouse hover an element and the declaration is displayed in tooltip.
One problem in code editor is if the member belongs to a Module. It display the declaration, but you can't see directly that it is Shared. You know one thing though, unqualified it can only be a module member or an instance member of the current class. If you can't recall you can use the context menu 'go to definition' to see where that member came from.
 
thanks for your answer. but what i want to know is that. do we have a good way to know that the method we use in a class is shared or not. or we need to memorize them all by ourselves? thanks for reply.
 
if any one know a best site to chat to discuss about the vb.net forum. please tell me. i want to know much more about the vb.net. and if some one have good site to give exercise about it. please tell me. thanks alot.
i have facebook. please add me to chat about the vb.net or other programming language.
address : email address removed by moderator
thanks
 
If a method is shared you dont have to instaniate an object to use it.

String.Format(...)
if a shared method, no need to instance an object.

dim Cnn as new sqlConnection
Cnn.ConnectionString="..."
Cnn.ConnectionString is a member of sqlConncention which must be instanced first before using.
 
If a method is shared you dont have to instaniate an object to use it.
The question is not what the difference is, or how to use the two, but how can you know/tell if a method is shared or not. Which was already answered in different ways.
 
Back
Top