473,406 Members | 2,369 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,406 software developers and data experts.

Shared or not shared (vb.net)

I'm building a control with a property which values depend on the
current different files in a resourcefile.
Users that use my control can edit the property by selecting from a
dropdownlist which lists all the files in the resourcefile.
This list is being created in the constructor of my control.

Now i'm wondering ... whether i should make that list a private shared
member of the class, or just a private member.
My thought was that shared would be cool, so that on creation of
multiple of my control ... the list wouldn't have to be rebuilt
everytime...but...if after creating 1 of my control, the user adds a
file to the resourcefile... the control wouldn't be listing that newly
added file ...

Any idea how i can cleanly solve this issue?

thx

Nov 20 '05 #1
2 1766
In article <Y1*********************@hestia.telenet-ops.be>,
ju**@sotto.invalid says...
I'm building a control with a property which values depend on the
current different files in a resourcefile.
Users that use my control can edit the property by selecting from a
dropdownlist which lists all the files in the resourcefile.
This list is being created in the constructor of my control.

Now i'm wondering ... whether i should make that list a private shared
member of the class, or just a private member.
My thought was that shared would be cool, so that on creation of
multiple of my control ... the list wouldn't have to be rebuilt
everytime...but...if after creating 1 of my control, the user adds a
file to the resourcefile... the control wouldn't be listing that newly
added file ...

Any idea how i can cleanly solve this issue?


Shared (static) methods are useful when they need no instance data to
work with. They simply take one or more parameters, act on them and
return data -- nothing tied to an instance of the class.

It sounds like this list is being used by each instance of the control.
In that case, I would keep it an instance member.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
If the list is the same between all instances of your control, then shared
would probably be appropriate.

To overcome the resource file changing, you could either use a
FileSystemWatcher and reload the shared list (which would allow all
instances to reflect the changes immediately), or allow some type of manual
(user-initiated) refresh.

"sotto" <ju**@sotto.invalid> wrote in message
news:Y1*********************@hestia.telenet-ops.be...
I'm building a control with a property which values depend on the
current different files in a resourcefile.
Users that use my control can edit the property by selecting from a
dropdownlist which lists all the files in the resourcefile.
This list is being created in the constructor of my control.

Now i'm wondering ... whether i should make that list a private shared
member of the class, or just a private member.
My thought was that shared would be cool, so that on creation of
multiple of my control ... the list wouldn't have to be rebuilt
everytime...but...if after creating 1 of my control, the user adds a
file to the resourcefile... the control wouldn't be listing that newly
added file ...

Any idea how i can cleanly solve this issue?

thx

Nov 20 '05 #3

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

Similar topics

0
by: Ron Ben-Natan | last post by:
Hi, Local clients talking to the server do so over the shared memory net-library. As far as I understand they use a shared memory segment and an event to signal each other when data is ready....
2
by: Dan Baker | last post by:
I'm relatively new to the .cs world. I would like to have some "shared" .cs files, which several solutions can use. I don't want to place these in a ..dll, I simply want them included into...
23
by: Kevin | last post by:
I'd like to declare my connection string as a public shared variable, to be used throughout my ASP. Net projected (created using VB.NET 2003). Below is the line of code: Public Shared conStr As...
1
by: David Sanschagrin | last post by:
(I previously posted this problem on vb.general.discussion but I've been told that this question is more related to VB.NET than VB6 and so that I should post that here.) I'm trying to call a...
10
by: John | last post by:
Trying to find out what is essential / optional, I made an extremely simple Class and Module combination to add two numbers. (see below) It appears that an empty constructor is needed n order to...
6
by: pinorama123 | last post by:
I have an ASP.NET application that contains a few classes that I have built. One of my objects is a user object. I have a pretty basic question about how this would work. If I have multiple...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
1
by: DaBrain | last post by:
Thanks for any replies in advance. I am C# Developer messing with VB.NET because I must move MANY Functions on a web site that are written in inline HTML <SCRIPT and I want to put them all in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.