A "basic" question - I think!

  • Thread starter Thread starter Keith Rebello
  • Start date Start date
K

Keith Rebello

I have an object called ColumnSection which represents a reinforced concrete
column. This object contains an arraylist called Diagrams which contains
Graph2D objects which are essentially X-Y plots. The Graph2D object has 2
public methods - Draw, which draws the plot on a bitmap in memory and
DisplayGraph which blits the bitmap on to a Panel or PictureBox.

I have a public ReadOnly property in the ColumnSection called
InteractionDiagrams which returns the Diagrams arraylist. I want to be able
to get the arraylist in a form with a PictureBox.

Questions:

1. Should the InteractionDiagrams property return the Diagrams arraylist or
a clone of the Diagrams arraylist? Are there any issues either way?

2. Is there anything wrong in calling either the Draw or DisplayGraph
methods of the Graph2D objects in the Diagrams arraylist from the form with
the PictureBox?

Any thoughts would be greatly appreciated.

Keith.
 
Keith,

Regarding (1): What will your code do with the Diagrams ArrayList?

Regarding (2): Not quite clear what you mean. Can you provide sample code?


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
 
Mike,

The InteractionDiagrams property will be one of the following:

Get
Return Diagrams
or
Return Diagrams.Clone
End Get

My question is which "Return" should I use.

Once I have the Diagrams arraylist in my calling form (the one with the
PictureBox), I want to be able to do:

Dim Gr2D as Graph2D
Gr2D= Diagrams(i)
Gr2D.DisplayGraph

Is this permissible?
 
Keith,

In this scenario there appears to be no reason to Clone.

Mike
 

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