C
Chuck Bowling
I'm really stumped on this. Serializing an ArrayList to XML works fine when
i use built in classes but when i try storing my own classes in ArrayLists
and serializing them the CLR throwns an exception. Can someone give me a
clue as to what's going on?
using System;
using System.Collections;
namespace tApp
{
public class TestClass
{
public string myStr;
public TestClass(string s)
{
myStr = s;
}
}
public class Class1
{
public ArrayList arr;
public Class1()
{
arr = new ArrayList();
for(int i=0; i<5; i++)
{
arr.Add(new TestClass((string)"Line #" + i.ToString()));
}
}
}
}
i use built in classes but when i try storing my own classes in ArrayLists
and serializing them the CLR throwns an exception. Can someone give me a
clue as to what's going on?
using System;
using System.Collections;
namespace tApp
{
public class TestClass
{
public string myStr;
public TestClass(string s)
{
myStr = s;
}
}
public class Class1
{
public ArrayList arr;
public Class1()
{
arr = new ArrayList();
for(int i=0; i<5; i++)
{
arr.Add(new TestClass((string)"Line #" + i.ToString()));
}
}
}
}