Static class in ASP.net website using VB.net

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?
 
Y

Yitzak

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
 
Y

Yitzak

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..
 

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

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top