Re: Get/Set Property for Array

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Mr. Arnold" <"Mr Arnold wrote:
Ben Voigt [C++ MVP] wrote:


"Mr. Arnold" <MR. Arnold@xxxxxxxxxx> wrote in message
news:OaWdTuJ4JHA.140@xxxxxxxxxxxxxxxxxxxxxxx

"Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxxxxxx> wrote in message
news:0B00B080-A3C9-489C-A3EE-81174CCDFE71@xxxxxxxxxxxxxxxx
Here is an example.

private Arraylist _jpmsft = new Arraylist();

What's this Arraylist? Never run into it before. And if you
mean System.Collections.ArrayList, that's been dead since Visual
Studio 2005.


The ArrayList has been dead since VS 2005, when I just
instantiated an ArrayList() object in VS 2008 from the
System.Collections? Just because you don't use something does that
make it dead. If I
have a need to use an Arraylist, then I going to use one. You may
have a different opinion. <G>

It's a fact that you can't get case sensitivity right when your
error is pointed out to you, and it's a fact that the generic
List<T> is superior to ArrayList in every way I can think of (type
safety, performance, removing the broken "threadsafe" wrapper,
etc).

So? If I have a needed to use an ArrayList(), I am going to use one.

Sounds good to me. But I have never run into a situation where
List<T> couldn't be used and I needed an ArrayList.

So maybe you could give an example of a need to use an ArrayList.



So what if I wanted to bring back two different serialized objects
back from a WCF service without making two calls?

The easiest way to do that would be to use and ArrayList that is not
type safe as a container to hold both objects and cast them back to
their type on the other side..

What if I wanted to have an int that has a count of how many objects
there were in the list followed by the objects, then another int
telling how many objects followed by its objects, casting back on the
other side as I walked the ArrayList(). You can do that with an
ArrayList().

You don't need ArrayList, List<object> will work just fine.

In the first instance you can use a more specific type if for example both
objects return the same interface.

For the second, sounds like you should be using List<List<T>>, so the
deserializer will construct all the sublists for you. Walking that list is
just an extra chance for things to break.

Any other example of a need for ArrayList?


.



Relevant Pages

  • Re: Get/Set Property for Array
    ... "Mr. Arnold" wrote in message ... private Arraylist _jpmsft = new Arraylist; ... The ArrayList has been dead since VS 2005, when I just instantiated an ArrayListobject in VS 2008 from the System.Collections? ... What if I wanted to have an int that has a count of how many objects there were in the list followed by the objects, then another int telling how many objects followed by its objects, casting back on the other side as I walked the ArrayList. ...
    (microsoft.public.dotnet.languages.csharp)
  • Print value of p from the infinite series
    ... But, dead end with weird logic-error. ... It tooks 1688 terms to accomplished the task. ... the `p in int' should yield 3141, but it return 3140 and take another ...
    (comp.lang.java.help)
  • Re: Thou shalt have no other gods before the ANSI C standard
    ... Hint: I use a version of GCC with 16-bit int every day. ... dead branch, either. ...
    (sci.crypt)
  • Re: Character Constants
    ... Undefined behavior. ... You're dead. ... defined int constant is outside the range of char and an implementation ...
    (comp.lang.c)
  • Live vs. Studio Dead 1967-69
    ... music is like being in a rowboat in the ocean.” - Jerry Garcia ... The Dead were known as live improvisers who could never quite pull it ... wowed audiences were rarely found on their studio albums. ... when they had an album to make, they would stay in the studio month ...
    (rec.music.gdead)