Trouble with ArrayList

A

Alberto

When I was working with vs 2003 I was used to do thinks like this:

ArrayList a = new ArrayList();
Doc d = new Doc();

d.field = "value";
a.Add(d);
....
((Doc)a[0]).field = "other value";


And it works very well. But now, in vs2005 it doesn't work and I don't know
why.
How can I make it works in vs2005?
Thank you very much.
 
?

=?iso-8859-1?Q?Lasse=20V=e5gs=e6ther=20Karlsen?=

When I was working with vs 2003 I was used to do thinks like this:
ArrayList a = new ArrayList();
Doc d = new Doc();
d.field = "value";
a.Add(d);
...
((Doc)a[0]).field = "other value";
And it works very well. But now, in vs2005 it doesn't work and I don't
know
why.
How can I make it works in vs2005?
Thank you very much.

Why do you think it doesn't work?
- compiler error? if so then we need to see the error
- exception? if so then we need to see the exception message and type
- does not give the expected results? then we need to see the declaration
of Doc, as well as an explanation of how you verify that it does what its
supposed to do
 
M

mustapha.jouad

hi,
i hope that you are in step of migration,
i have a task to migrate to VS 2005,
i hope so for you some docs or comment for
strategy to follow for that.



Cordailement,
Jouad
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,
...
((Doc)a[0]).field = "other value";


And it works very well. But now, in vs2005 it doesn't work and I don't
know

That should work fine, what is the error you are getting?
 
A

Alberto

It was an error. I was typing ((Doc)a).field.
Thank you everybody.

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,
...
((Doc)a[0]).field = "other value";


And it works very well. But now, in vs2005 it doesn't work and I don't
know

That should work fine, what is the error you are getting?
 

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

Top