Static class in ASP.net website using VB.net

  • Thread starter Thread starter Yitzak
  • Start date Start date
Y

Yitzak

Hi

I want to create a static class, or in old vb6 terms a bas module to
add to my website.

Basically to hold utility functions routines that hold no state.

How to I achieve this. VB.Net has modules but not when using vb
asp.net website.

Am I missing something?
 
http://www.google.co.uk/search?sourceid=navclient&aq=s0&oq=VB.NET s...

However, by *VERY* careful if you intend to implement shared (static in C#)
variables in a WebForms solution, as they will be shared across all
Sessions...

Thanks ALOT Mark.

I kept finding references to bas modules (old VB) which would suit me
fine - but couldn't find them in asp.net project. And static class
yielded all vb.net client/server examples. I guess they don't exist in
asp.net projects.

I'm just using it for utility functions that hold no state. Constants
probably stick in webconfig.

thanks
 
Assuming a web site project, just add a class file and replace the class
statement with Public Module MyModule as usual...

A module is basically a class which only static members. My personal
preference would be to use a class as it' ll force the use of its name.

I would use a module only when I have to (extension methods or perhaps for
rare cases where I would like to make something appear as a VB.NET
statement).

--
Patrice

"Yitzak" <[email protected]> a écrit dans le message de groupe de
discussion :
(e-mail address removed)...

Patrice - you are right you can change the definition to module..

Thanks - will stick with class and shared methods..
 
Back
Top