Using Functions Inside A Shared Member

N

Nathan Sokalski

I have a class that is just a bunch of Shared functions (basically, a bunch
of utilities I have grouped together). However, there are functions that I
want to write to use inside some of these Shared members that I do not want
available outside the class. Here is the basic layout of my class:


Public Class Utilities
Public Shared Function Utility1() As String
End Function

Private Function UtilityHelper() As Integer
End Function
End Class


I would like to use my function UtilityHelper() inside Utility1(), but not
make it available outside the class. However, when I try to do this I
recieve the following error:

Cannot refer to an instance member of a class from within a shared method or
shared member initializer without an explicit instance of the class.

How can I write methods that are used only inside a class, and can be used
in the class's Shared members? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top