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

Global Array Structure

wg
I am new the C# coming from a VB6 world. In VB6 I have serveral applications
where I create a UDT in a module then make an array of the UDT. All modules
and forms could access this. Now I am attempting to do this in C#. I would
like to create a Structure then an array of that, (ex. Variable[0].Name,
Variable[0].Value). But I need several classes to have access to the data.
It must be an array because I update some of the values.

Another possiblity is to have the array of strucuture in a single class that
other classes can have access to the data to update.

Can anyone point me in the right direciton.
Jan 21 '06 #1
2 5256
wg,
I am new the C# coming from a VB6 world. In VB6 I have serveral
applications where I create a UDT in a module then make an array of the
UDT. All modules and forms could access this. Now I am attempting to do
this in C#. I would like to create a Structure then an array of that, (ex.
Variable[0].Name, Variable[0].Value). But I need several classes to have
access to the data. It must be an array because I update some of the
values.

Another possiblity is to have the array of strucuture in a single class
that other classes can have access to the data to update.

Can anyone point me in the right direciton.


Create a namespace that will contain these "utility" classes. In that
namespace, create a public class that exposes public methods (API) that
define all of the UDT behavior that the application needs. Implement
private members (fields and methods) that perform the inner workings of the
class and the API. Once it is working and tested, refactor it to ensure
that all code is expressed once and only once and that the interface is
clear and concise. You can then import the namespace and use the UDT class
and API wherever you need it.

If you need a single instance for the entire application, implement the
class using the "Singleton" design pattern.

To do this, you may have to unlearn some of the VB6 approaches that may be
part of your developer tricks of the trade. Good luck and I hope this
helps.

Regards,

Randy
Jan 21 '06 #2
wg,

You will need to declare the array as public and static in order to have
all other classes access it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"wg" <wg@hotmail.com> wrote in message
news:Hw****************@bignews4.bellsouth.net...
I am new the C# coming from a VB6 world. In VB6 I have serveral
applications where I create a UDT in a module then make an array of the
UDT. All modules and forms could access this. Now I am attempting to do
this in C#. I would like to create a Structure then an array of that, (ex.
Variable[0].Name, Variable[0].Value). But I need several classes to have
access to the data. It must be an array because I update some of the
values.

Another possiblity is to have the array of strucuture in a single class
that other classes can have access to the data to update.

Can anyone point me in the right direciton.

Jan 21 '06 #3

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

Similar topics

33
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
7
by: Sam | last post by:
Hello I have a structure called Company. struct Company { char *employee; char *employee_address; }; I want to build an array of this structure but the number of employees will change...
4
by: Harry | last post by:
Good Day, I am writing a code for the H.264 Video codec.I am using VC++ compiler,but programming is in c only.I have grouped the related global variables under one structure in a header file...
23
by: David Colliver | last post by:
Hi, using c#, 1.1 I know that we are not supposed to use global variables etc. in c# I am having a problem, but not sure how to resolve. I did have another post here, but may have over...
2
by: hankypan1 | last post by:
Hi All, I need a tree data structure for my application. It is the non - cyclic simple tree where i can have any number of children node and each child can recursively become a sub tree like a...
4
by: koffee | last post by:
Hi people, I've got a question on global structure initialization. A global variable like int can be explicitly initialized as: int Global = 1; But how can I explicitly initialize a...
1
by: sunil | last post by:
Hi, Am developing one shared library for one application. In that .so am having one global array of structure ( two more different structure pointers in this struct). Once the application is...
5
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.