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