Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 in VB we use "module" in C#???

Author  Topic 

olay80
Yak Posting Veteran

62 Posts

Posted - 2005-04-26 : 05:45:37
hey guys,

well i'm trying to define like 50 constant variable required by my code. in asp.net we can put them in something called "module" if i'm not mistaken and could be accessed directly, is there something like that in .Net(C#)?
i don't want to declare them in a class and set a "get" function for each to retrieve the value. any ideas??

thanx,
Oliver

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2005-04-26 : 07:45:08
A module in VB.NET is actually a class that is automatically instantiated only once per application instance. You can replicate the same behaviour in C# by declaring a public static class. You then dont need to explicitly instantiate the class and all public members can be accessed directly.

OS
Go to Top of Page
   

- Advertisement -