Arjen
here is a "Short but Complete" (a-la Jon Skeet) example that works fine for
me:
using System;
using System.Collections;
using System.Data;
namespace ArrayListTest
{
class TestMe
{
[STAThread]
static void Main(string[] args)
{
test myTest = new test();
DataSet ds = new DataSet();
ds.DataSetName="TestDs";
myTest.myList.Add(ds);
DataSet ds2 = (DataSet)myTest.myList[0];
Console.WriteLine(ds2.DataSetName );
Console.ReadLine();
}
}
public class test
{
public ArrayList myList = new ArrayList();
}
}
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Arjen" wrote:
Hi,
public class test {
public ArrayList myList = new ArrayList();
}
test myTest = new test();
myTest.myList.Add(<someobject>);
This results in an error.
I also tried to add objects inside a new arraylist.
And then set the new arraylist to the object arraylist.
test.myList = newarraylist;
This also results in an error.
How to add objects to this arraylist?
Thanks!