ArrayList problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Spencer

    #16
    Re: ArrayList problem.

    Honestly, I don't know why you're using an ArrayList. An ArrayList is a
    Collection of type object, which means that one must use casting to cast any
    element in the ArrayList to the type that it is. In addition, as a
    Collection, it is a variable-length list. If you want a fixed sized list of
    the same data type, your best bet is to use an array:

    GraphTimeScale[] TimeScale = new GraphTimeScale[1000];

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    You can lead a fish to a bicycle,
    but it takes a very long time,
    and the bicycle has to *want* to change.

    "GTi" <tunlid@gmail.c om> wrote in message
    news:1137539629 .982385.39930@z 14g2000cwz.goog legroups.com...[color=blue]
    > (where did the sample go?)
    >
    > class TimeScale
    > {
    > public double TempSP = 0.0;
    > public double TempER = 0.0;
    > public double PresureSP = 0.0;
    > public double PresureER = 0.0;
    > }
    >
    >
    > maxitems=1000; // from a calculation
    > ArrayList TimeScale = new ArrayList(maxit ems);
    >
    > for(int a=0; a<maxitems; a++)
    > {
    > TimeScale gts = new GraphTimeScale( );
    > gts.TempSP = somevalue2;
    > gts.TempER = somevalue3;
    > gts.PresureSP = somevalue4;
    > gts.PresureER = somevalue5;
    > TimeScale[a]=gts;
    >
    > // NOTE in this sample I should use .add(gts);
    > but <a> can be any number from 0 to maxitems and not all indexes is
    > filled.
    >[/color]


    Comment

    Working...