Re: Hours

From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 07/14/04


Date: Wed, 14 Jul 2004 12:49:49 -0500

Geoff,
> but that doesn't say if it holds strings, doubles or integers etc.
ArrayList holds objects, when you take a value out you need to cast the
value to the specific type you put in.

If you want strongly typed, either use pure arrays, either:

    Dim y()() As DateTime ' Array of Arrays of DateTime

    Dim x(,) As DateTime ' 2 dimensional

The "problem" with both of these is that both dimensions are "fixed",
System.Collections.ArrayList is dynamic, in that you can add elements to it.

If you want a strongly typed "ArrayList" you can inherit from
System.Collections.CollectionBase and create a strongly typed list.

NOTE: VS.NET 2005 (.NET 2.0) (Whidbey) due out sometime next year, will
support Generics so it will be easier to get an array of list of datetime...

Hope this helps
Jay

"Geoff Jones" <geoff@NODAMNSPAM.com> wrote in message
news:40f56ed3$0$296$cc9e4d1f@news.dial.pipex.com...
> That helps a lot. Thanks Jay
>
> As you can gather, I'm very new to programming. Your help and others is
> invaluable during my steep learning curve.
>
> One question that occurs to me now how to tell the ListArray what values I
> need to store. I know for an array this can be done as:
>
> Dim x() As Integer
>
> However, and forgive me if this is wrong, I set up an array of an
ListArray
> by
>
> Dim y() As ListArray
>
> but that doesn't say if it holds strings, doubles or integers etc.
>
> Can you help?
>
> Geoff
>
> "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message
> news:uzRAaScaEHA.3716@TK2MSFTNGP11.phx.gbl...
> > Geoff,
> > I would use an array of arrays or an array of ArrayLists.
> >
> > I would expect index 0 be from midnight to 1:00?
> >
> > Then you can simply use the hour of the Time (DateTime.Hour) as your
> index,
> > and use ArrayList.Add to add the time to that row...
> >
> > Hope this helps
> > Jay
> >
<<snip>>



Relevant Pages

  • Re: string.Format with arrays
    ... > The following variations of string.Formatwill work just fine with strings: ... > And I can format a list of doubles like this: ... > Why does the array version work with strings but not doubles? ... An array of doubles isn't an array of object references, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: .NET 2.0 performance bug in ArrayList.Sort
    ... The data are strings of about similar size in bytes and number. ... Time to sort strings in stringarray is: ... ArrayLists, however in this case the slowdown is really bad comparing ...
    (microsoft.public.dotnet.general)
  • Re: Reflection Performance Question.
    ... Something that does the gruntwork at design time rather than at runtime. ... Regarding arrays vs. arraylists -- arrays hold items of a specific data ... but arraylists are lists of objects and thus you have boxing / ... overhead is significant, so if you can live with an array, it's a good way ...
    (microsoft.public.dotnet.framework.performance)
  • Re: sort 1-D array of doubles for Olaf Schmidt
    ... but I just wanted to alter Olaf's code so that it would handle a 1-D array of doubles rather than a 1-D array of ... If you're looking for speed then you don't want to be shifting strings or doubles about at all, ...
    (microsoft.public.vb.general.discussion)
  • Re: Grid in ASP.Net like Windows Forms
    ... Hey Alfredo. ... Array vs. ArrayList ... I often use ArrayLists to get my data initially, ... I would say these type of objects are better to session than viewstate. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading