Reusing Code Snippets

  • Thread starter Thread starter - Steve -
  • Start date Start date
S

- Steve -

I'm working on my asp.net site and I'm wondering what the best way to reuse
little snippets of code is?

Right now I have a Class in it's own cs file that I call Snippets. Then
when I want to use something in there (like for example I have
Snippets.Logout()) I do the following.

Snippets snips = new Snippets();
snips.LogOut();

But what I really want to do is just run Snippets.Logout(), like for all
functions that come with .Net.
 
What I meant to say was declare all your methods as Shared/static. And make
your constructor private.

Public Class Snippets
Private Sub New()
End Sub

Public Shared Function DoSomething() As Object
'blah blah
End Function
End Class

Greg
 
Back
Top