Trouble with ArrayList

  • Thread starter Thread starter Alberto
  • Start date Start date
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.
 
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
 
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
 
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?
 
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?
 
Back
Top