473,320 Members | 1,804 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,320 software developers and data experts.

Global classes

I have a instance of a class that needs to be access by mutliple parts of my
application.

How do I make this instance global to my entire application?

Thanks
Jul 21 '05 #1
3 1097
Relaxin <me@yourhouse.com> wrote:
I have a instance of a class that needs to be access by mutliple parts of my
application.

How do I make this instance global to my entire application?


See http://www.pobox.com/~skeet/csharp/singleton.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Relaxin,

When it is VBNet you can use a module (what I don't like) or a so called
shared class.

A shared class has only shared variables, properties and methods.

Something as
\\\
public class MyShared
friend shared readonly property MyName() as string
get
return "Relaxin"
end get
end Class
///

I hope this helps?

Cor

"Relaxin" <me@yourhouse.com>
I have a instance of a class that needs to be access by mutliple parts of
my
application.

How do I make this instance global to my entire application?

Thanks

Jul 21 '05 #3
Hi,

You could go for:
1. a singleton class
2. a class exposing static properties
3. a static class (if you are using Whidbey)

HTH,
Rakesh Rajan

"Relaxin" wrote:
I have a instance of a class that needs to be access by mutliple parts of my
application.

How do I make this instance global to my entire application?

Thanks

Jul 21 '05 #4

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

Similar topics

10
by: Matt | last post by:
Greetings, What are people's thoughts on global variables in C++? Why are we taught not to use them in programming? Is it true that if you are running two copies of the C program one copy can...
8
by: Jan-Henrik Grobe | last post by:
Hallo, normally I am not the one who calls a Newsgroup if something does not work. But now I am frustrated. I did write a program with a lot classes. I use some gloabl variables which are in a...
4
by: Simon Harris | last post by:
Hi All, I'm new to ASP.Net, so be gentle! (Plenty of 'classic' ASP experience), just one question... - Am I correct in thinking that global functions are stored in ASCX files? Thanks! ...
22
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to...
14
by: Alan Silver | last post by:
Hello, I have spent ages trawling through Google, looking for information about global functions in ASP.NET and I'm still not clear about the best way to go about this (or not). I am writing...
10
by: Ronnie | last post by:
I've created a simple web application using VS2005 Beta 2. Basically, I've added a Web Form and a Global.asax file. In my Global.asax, I create a method like: public static void TestGlobal()...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
4
by: Sheldon | last post by:
Hi, I have a series of classes that are all within the same file. Each is called at different times by the main script. Now I have discovered that I need several variables returned to the main...
11
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.