471,336 Members | 1,323 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 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 5156
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

104 posts views Thread by Leszek | last post: by
7 posts views Thread by Sam | last post: by
4 posts views Thread by Harry | last post: by
23 posts views Thread by David Colliver | last post: by
4 posts views Thread by koffee | last post: by
5 posts views Thread by =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post: by
reply views Thread by rosydwin | last post: by

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.