"ArrayList does not contain a definition for Item" - Tell me I'm being stupid

D

Daisy

error CS0117: 'System.Collections.ArrayList' does not contain a definition
for 'Item'

Only one answer in Google Groups, and I'm positive I'm using it
correctly...!

Posts is my ArrayList.

I put in some posts:

for (i = 0; i < 15; i++)
{
myPost = new Post();
myPost.Key = i;
myPost.Level = i;
myPost.Subject = "The Subject " + i.ToString();
myPost.Author = "Test " + i.ToString();
bottomControl.Posts.Add(myPost);
}

Try and get them back out

for (int i = 0; i < Posts.Count; i++)
{
Post aPost = Posts.Item;
}

To get the error at the top. Foreach works, but I need a count too, so this
loop seems the best way.

I'm sure I'm doing something really stupid, but I really just can't figure
out what! :blush:(

Thanks,
 
D

Daisy

Daisy said:
error CS0117: 'System.Collections.ArrayList' does not contain a definition
for 'Item'

Yes, I was being stupid. I don't need Item!! Doh !

:O)
 

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