how best to represent this?

  • Thread starter Thread starter John Salerno
  • Start date Start date
J

John Salerno

Ok, concerning my little pet project...I have int arrays of the
following sizes:

panel[][,]
AND
panel[][][,]

They are static fields right now, and I'm wondering if it's possible
(and better) to make them separate classes/objects of type Panel.

First off, here's the information for the object:

There are four panels (represented by the first index with values 0-3).
There are eight switches on each panel (second index, 0-7).
Each switch controls twenty lights that may or may not turn on (third
index ranging from [0,0] to [1,9]).

So, my questions:
1. If I make this an object rather than a static field, should it be a
struct or class? It's integers, but I'm guessing the fact that it's an
array means it's a class.

2. Should it inherit from ArrayList?

3. How do represent the index values when making a class? Can you create
complex indexers like [][][,]?

4. Is it possible to create properties like this:

panel.SecondPanel.ThirdSwitch.FifthLight?

If so, how do I define those properties so that they return the proper
value?

One thought is that the static field gets moved to the Panel class, and
the class works with it internally, but I still don't know how to
implement all this.

Thanks.
 
If this is .NET 2.0, you could create a generic List of
panel classes.

You could also have each panel contain child panels.

I'm not 100% of the flexibility requirements and
how you are utilizing a panel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top