Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 31st, 2006, 7:58 PM   #1
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
ArrayList and MSDN

I see MSDN has some things on the ArrayList object, but I can't use them in my program. How do I include them in my program? I've tried #include <ArrayList>, but that didn't work...
Writlaus is offline   Reply With Quote
Old Apr 1st, 2006, 4:28 AM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
It's for C# (.NET). You will have to do with std::vector or the likes.

P.S. In C# you would do: using System.Collections;
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 1st, 2006, 4:45 AM   #3
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3 Jimbo is on a distinguished road
I'm pretty sure you can use the .NET libraries in VC++, but I've never actually tried. You might want to look at some of their example codes and see how they do it. Quick snippet from one of their pages:
Quote:
Originally Posted by msdn
[C++]
#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
Jimbo is offline   Reply With Quote
Old Apr 1st, 2006, 4:47 AM   #4
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Jimbo, you are right, VC++.NET. Not C++ though.
If I was going to do .NET, I'd definitely use C#.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 1st, 2006, 4:56 AM   #5
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3 Jimbo is on a distinguished road
Quote:
Originally Posted by nnxion
If I was going to do .NET, I'd definitely use C#.
agreed
Jimbo is offline   Reply With Quote
Old Apr 1st, 2006, 8:29 PM   #6
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
Is there something I can use like an ArrayList in C++?

An ArrayList is just a list that you can keep adding elements to, and the size will increase as the amount of items in the list increases.
Writlaus is offline   Reply With Quote
Old Apr 2nd, 2006, 12:17 AM   #7
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
You're probably looking for std::vector.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Apr 2nd, 2006, 5:07 AM   #8
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by InfoGeek
You're probably looking for std::vector.
Thanks for repeating that, he needed it.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 2nd, 2006, 12:34 PM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Jimbo's right, and if you're making a .NET application, you probably want to use the System::Collections::ArrayList class as opposed to std::vector so your application can be ported to different languages easily.

As an aside, .NET 2.0 provides the System::Collections::Generics::List class, which is more equivalent to std::vector in that it is a template class which holds one specific type of object, as opposed to the ArrayList, which can contain any object. The difference can be seen as follows:

using System;
using System::Collections;
using System::Collections::Generics;

...

ArrayList myArrayList;
myArrayList.Add("foo");
myArrayList.Add(3);

List<Int32> myList;
myList.Add(4);
myList.Add(37);

// prints: foo 3
Console::WriteLine("{0} {1}", (String)myArrayList[0], (Int32)myArrayList[1]);
// prints: 4 37
Console::WriteLine("{0} {1}", myList[0], myList[1]);

Disclaimer: not tested, sorry.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 2nd, 2006, 8:30 PM   #10
Writlaus
Hobbyist Programmer
 
Writlaus's Avatar
 
Join Date: Nov 2005
Posts: 149
Rep Power: 4 Writlaus is on a distinguished road
I'm using C++ though--Isn't that :: operator for some other language?
Writlaus is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:17 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC