Jump to content
  • Advertisement
Sign in to follow this  
deathwearer

[C# 2.0]Trouble with Object ArrayList

This topic is 4369 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Ah thank you. Could have search for years. I'm not too familliar with .NET stuff yet. Mostly used to java, that's why I was using an ArrayList ;)

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!