473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

c# equal to vb module

I'm writing a c# 3.0 app and want to know if there is anything similar to
the vibe module. I want to cache some data in memory for all classes to
access during the app session which will avoid having to access the data
source each time its needed. this data is mostly static for the session.
As I understand, a static class can not hold class level variables. I want
to create an instance of a class, have it read this data into class level
variables, then any class in the project can access this instance and
thereby not having to create new instances making them read from the data
source over and over again.

Is this possible?

--
mo*******@noemail.noemail
Mar 19 '07 #1
4 1328
moondaddy wrote:
I'm writing a c# 3.0 app and want to know if there is anything similar to
the vibe module. I want to cache some data in memory for all classes to
access during the app session which will avoid having to access the data
source each time its needed. this data is mostly static for the session.
As I understand, a static class can not hold class level variables. I want
to create an instance of a class, have it read this data into class level
variables, then any class in the project can access this instance and
thereby not having to create new instances making them read from the data
source over and over again.

Is this possible?
C# does not have module.

But take a look at singleton pattern.

Arne
Mar 19 '07 #2
>I'm writing a c# 3.0 app and want to know if there is anything similar to
the vibe module.
A static class is as close as it gets. The difference is that module
members are automatically imported to the global namespace in VB, and
they are implicitly Shared/static (whereas C# forces you to still mark
each member as static). The end result is largely the same though.

>As I understand, a static class can not hold class level variables.
Only static variables.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Mar 19 '07 #3
Hi Moondaddy,

The VB.NET module come from the VB6 module which provides global shared
functions among the application. For .NET application developing through
C#, if you also want such public shared functions or variables as in VB.NET
module, you can consider define some public class with static member
variables/functions. Thus, those functions and variables can be visible and
accessible from other class code. And since they're marked as static, the
shared scope is the entire AppDomain. At runtime each AppDomain will has a
single copy of such static class variables.

If you have any further questions or concern, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 20 '07 #4
Hi Moondaddy,

Have you got any further idea on this issue or do you have any other
questions? If there is any else we can help, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: tekanet | last post by:
Hi folks, I'm new with MySQL and I'm really impressed by this database engine. While waiting for Stored Procedures :) (ver 5: anyone can say when will be, approximately, released?), due to the...
4
by: Jeremy Howard | last post by:
Hello everyone, I'm not a database guru so I'm sorry if this is a dumb question but here it goes... I have this sql query that I'm trying to run against a table on a Sql 2k server: SELECT ...
7
by: ale.of.ginger | last post by:
Another question: I am writing a sudoku solving program. The 'solving' part of is just multiple iterations. It will take random numbers and keep switching it all around until a set of logic...
15
by: Murt | last post by:
Hi, when writing equations in vb .net, how do you enter the signs "less than or equal to" etc. thanks Murt
5
by: Yves Glodt | last post by:
Hello, I need to compare 2 instances of objects to see whether they are equal or not, but with the code down it does not work (it outputs "not equal") #!/usr/bin/python class Test:
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
14
by: serge calderara | last post by:
Dear all, What is the proper way to check if two object are equal ? I do not mean equal on Object type only but also object value's thnaks for help regards serge
1
by: =?utf-8?B?5Lq66KiA6JC95pel5piv5aSp5rav77yM5pyb5p6B | last post by:
The follow statement comes from the Python 2.5 documentation -------------- encode( ]) Return an encoded version of the string. Default encoding is the current default string encoding. errors...
12
by: Slaunger | last post by:
Hi, I am new here and relatively new to Python, so be gentle: Is there a recommended generic implementation of __repr__ for objects equal by value to assure that eval(repr(x)) == x independet...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.