I am writing my first class-library in VB.NET. My idea is to distribute this library so others may use it in their applications.
However, perhaps due to my lack of experience in writing and structuring the library and the classes therein, I noted that the methods/properties are ALL being shown in the IntelliSense of Visual Studio.
The thing is that many of them are only used within the library itself and should NOT be used by the developers (could create a disaster) when they incorporate my library in their application - only a few should be visibile i.e. the ones which are needed by the developer.
Thus, my question is: is there a way to hide certain methods/properties of my library from Visual Studio's IntelliSense? Maybe something similar to REM?
Thanks in advance.
EDIT: as mentioned - this is my first library and I now understand that my question could be intepreted in two ways:
1) how to hide something from IntelliSense
2) how to prevent a developer from using and calling certain methods/properties
Of course, the end-result that I want is that the developer is not able to access AT ALL certain methods/properties i.e. No. 2 above.
Many thanks. I just learnt something new today and I will now study Access Levels...
Only the types/methods/properties you want to be visible should be declared Public
. The rest should be declared Private
, Protected
, Friend
or Protected Friend
.
You can read more about these access levels on the MSDN web page for them. In general you should usually only make things as public as they really need to be.
You need to change their access modifiers to something other than Public. If they are just used within a given class, make them Private Sub XYZ(). If they need to be accessed by other classes in the same assembly, make them Friend Sub XYZ(), etc.
http://msdn.microsoft.com/en-us/library/76453kax.aspx
If you want to hide them then add a filterpriority tag to the XML comment of the function with the value 3
''' <summary>
''' </summary>
''' <filterpriority>3</filterpriority>
''' <remarks></remarks>
Sub DontShowMe()
End Sub
This will hide it by default in intellisense. You can also control the placement in the Common/All tab with the values 1/2 respectively.
Blog Post on the subject: http://www.lostechies.com/blogs/sdorman/archive/2009/01/10/xml-comments-filterpriority.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With