Re: Get/Set Property for Array
- From: "Ben Voigt [C++ MVP]" <bvoigt@xxxxxxxxxxxxxxxx>
- Date: Wed, 3 Jun 2009 16:10:30 -0500
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?
.
- Follow-Ups:
- Re: Get/Set Property for Array
- From: Mr. Arnold
- Re: Get/Set Property for Array
- References:
- Re: Get/Set Property for Array
- From: Ben Voigt [C++ MVP]
- Re: Get/Set Property for Array
- From: Mr. Arnold
- Re: Get/Set Property for Array
- From: Ben Voigt [C++ MVP]
- Re: Get/Set Property for Array
- From: Mr. Arnold
- Re: Get/Set Property for Array
- Prev by Date: Overloading methods...
- Next by Date: Re: How2 use LINQ to get and display data from class in a DataGridView?
- Previous by thread: Re: Get/Set Property for Array
- Next by thread: Re: Get/Set Property for Array
- Index(es):
Relevant Pages
|