Sign in to follow this  
deathwearer

[C# 2.0]Trouble with Object ArrayList

Recommended Posts

Hello, I'm trying to make a simple ArrayList of object (of type Arguments which is an object of my own) but it doens't work It say : Error 1 The non-generic type 'System.Collections.ArrayList' cannot be used with type arguments C:\Documents and Settings\banane\Bureau\SGE\CommunicationSGE-0.002\CommunicationSGE\Requete.cs 15 16 CommunicationSGE On that line : public ArrayList <Arguments>listArguments = new ArrayList<Arguments>(); Thank

Share this post


Link to post
Share on other sites
ArrayList was the class from pre-2.0 .NET, before generics existed. The new class that does this, with a specific type, is System.Collections.Generic.List<>.

Share this post


Link to post
Share on other sites
One question. How do i retreive the object at the position 4 let's say.

You know like a vector in c++, vec.at(position);

If that's even possible with list.

Thank

-EDIT-

Found it myself. It's pretty dumb, i have to use [Position]. But MSDN didn't mention about it. weird.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this